Missing the point of loose languages
Missing the point of loose languages
Posted Dec 17, 2021 1:38 UTC (Fri) by rdeforest (guest, #153619)Parent article: Wrangling the typing PEPs
Languages like Python, PHP and JavaScript gained enormous popularity BECAUSE the users didn't have to deal with types. The barriers to entry were low and the things type information help with didn't matter enough. Adding type information to these languages after they've become popular misses the point of how they got popular in the first place. I would even posit that it objectively worsens them. The eventual of triumph of TypeScript over JavaScript would refute my claim, if it happens.
I would suggest as an alternative to extending existing dynamic languages, that those seeking these features instead choose languages built around them. But those languages (Haskel, I'm looking at you) don't have the enormous communities and the network effects they bring...
In other words, Richard P Gabriel was right all along: "Worse Is Better".
Posted Dec 17, 2021 15:56 UTC (Fri)
by tnoo (subscriber, #20427)
[Link] (3 responses)
Python was (still mostly is) so clean and at the same time powerful enough for all my use cases (data analysis, glue language for numerical codes). And just perfect for teaching introductory classes for scientists.
I highly welcome a generic type annotation system that codes like Cython make use of. But imposing a mandatory rigid typing system is the wrong approach. If strong static typing is needed, there is a big choice of other languages out there (go, rust, C++, Java, Haskell, ....ML).
But of course, this also comes with a high cost. Besides the need for compilation, for C++ we have the Design Patterns (Gang of Four) with Facade, Adapter, Decorator patterns etc that are not necessary in Python because of Duck-Typing.
For me Python is getting less and less attractive if more line noise is added, and simple code is becoming unreadable. From a comment above
def foo(a: object, b: type[T]) -> TypeGuard[T]:
does not look and feel like Python anymore. Why not use Haskell right away?
Posted Dec 17, 2021 16:57 UTC (Fri)
by mpr22 (subscriber, #60784)
[Link] (1 responses)
My understanding is that a lot of people who love static typing etc. still bounce off of Haskell.
(Partly because a lot of the literature around Haskell has a reputation for using terminology that even many CS graduates are unfamiliar with.)
Posted Dec 19, 2021 10:15 UTC (Sun)
by smurf (subscriber, #17840)
[Link]
That takes more up-front time and effort than most people want to spend. Plus everybody else in your team needs to do the same thing.
I was looking into using Elm (a Haskell-ish language for client-side web programming; transpiles to Javascript of course) recently. Great idea, but where do I get the month that's not in the calendar from, so that I can be up to speed on it?
Posted Dec 17, 2021 19:11 UTC (Fri)
by Wol (subscriber, #4433)
[Link]
The problem with my favourite language is everything is of type string (or variant). The advantage of this same language is that everything is of type variant. It would be lovely if I could just restrict things by having the default as variant, but options like "integer", "number", and stuff like that available ...
(Said favourite language being DataBASIC, btw)
Cheers,
Posted Dec 21, 2021 18:55 UTC (Tue)
by tbelaire (subscriber, #141140)
[Link]
Until I started annotating with types, I was dealing with "Oh, that's a bytes regex, doesn't work on str", on line xxx. And other errors, where as being careful and making sure the encoding/decoding happened exactly once, and using the types to check that across all the functions and not playing wack-a-mole with errors is so much nicer.
And when I'm working with pandas, I do want to know if I have a DF with only one column vs a Series, as the operations are different, but it's just `df['col'] ` vs `df[['col']]` to get each one. (I think). So I already need to check and keep the types separate, why not ask the compiler for help?
Posted Dec 27, 2021 8:26 UTC (Mon)
by NAR (subscriber, #1313)
[Link] (1 responses)
Posted Dec 27, 2021 9:59 UTC (Mon)
by smurf (subscriber, #17840)
[Link]
A decent set of test cases is great for checking that the expected cases work as expected. The problem is that some [ft]ools insist on tests for each and every unexpected case, even if logically impossible to reach, while the real problems (i.e. those conditions you didn't even think of being remotely possible when you wrote the code) slip under the radar.
Missing the point of loose languages
Missing the point of loose languages
Missing the point of loose languages
Missing the point of loose languages
Wol
Missing the point of loose languages
Missing the point of loose languages
Missing the point of loose languages