Hacker News new | ask | show | jobs
by valenterry 2050 days ago
> Because the framework is working on a level above the application, it can easily deal with objects without worrying about what is inside them.

Even for that there is no need for dynamic typing anymore. This problem has been solves with type parameters (aka generics) and type-classes.

1 comments

Not true.

In Python and Ruby it's an extremely common pattern to return a dictionary with a half-dozen entries at most that will be consumed at a single location.

Defining an entire class for this sort of extremely common use case is for the most part a waste of time.

These languages allow for the formalization of those types by creating classes out of them, but looking at what 50% of my functions do in web dev code, they're returning tuples, small dictionaries, or standard library objects.

What makes you think that statically typed languages don't have (type-safe) tuples or dictionaries?

Maybe you can give a minimal code example of what you mean and I'll show you how I would solve that in a statically typed way. :)

Which mainstream language supports anonymous structural types? C# is the only one that comes to mind and it's not a standard pattern AFAIK.
Wait a moment! Since when are we talking about only mainstream languages? And how is that even defined?

That's not fair play

Language features are a secondary consideration when compared to ecosystem and library availability as far as getting actual stuff done.

I never claimed those languages don't exist, but a language is a full package, and right now I'm not seeing even ascending languages as supporting trivial structural return types as an idiom. Granted, this is mostly a personal pet peeve given my observations and usage of code.

> I never claimed those languages don't exist

Yes you did. Let me quote:

Me: > Even for that there is no need for dynamic typing anymore. This problem has been solves with type parameters (aka generics) and type-classes.

This is obviously a general statement. I means "there can be a programming language where there is no need for dynamic typing to solve this kind of problem". And then I continue, that this problem has been solved. That means there is at least one such a language already existing which solves this problem with certain techniques.

Then you: > Not true.

And once I offer you a concrete implementation as an example, you suddenly change the topic to "but... no mainstream language". And if I would present you a language that could be considered as mainstream, I'm sure you would find another restriction such as "but this language does not have enough... libraries".

There certainly is no true Scotsman for you.