Nice.
https://github.com/erg-lang/erg/blob/726b7b80fcf06c6c4099b62... Using a 69 as your language's logo? I actually don't think it has been done in a serious-seeming project before.
Erg: a statically typed language that is Python compatible
71–80 of 194 posts
Re: Erg: a statically typed language that is Python compatible
#72Amazing, but... Why not done with Python syntax? And no, mypy is not a solution. Even with strictest mypy it is still possible to have errors that would have been caught with static typing.
Re: Erg: a statically typed language that is Python compatible
#73Earlier quoted context omitted.
I have a hunch that a lot of Python users didn't carefully evaluate the language on its merits, but rather, just started using it. In my own case, I was using Visual Basic 6 before Python, and mostly Turbo Pascal before that. A huge attraction of Python was the libraries -- scipy, matplotlib, etc. In fact when a lot of people say they're using "Python," they're actually referring to Python plus a large collection of…
I suspect the same. People adopt Python because its clean syntax and REPL make the language approachable and easy to get started and then the huge library ecosystem helps you glue together (in a good way) powerful systems. But how many Python users and libraries actually use the language’s extremely dynamic runtime behavior? Something they’re paying for with a big performance penalty and surprising bugs.
Re: Erg: a statically typed language that is Python compatible
#74Earlier quoted context omitted.
But is it the same problem, really? Static typing eliminates a whole class of issues that dynamic typed languages don't. Of course you can still have logical bugs, but it's definitely not the same thing. I don't know how to put it better, but you should try writing haskell sometime and you'll see what I mean.
And static languages introduce a whole class of issues that dynamic languages don't have to deal with. You have to learn a separate metalanguage just for the types that isn't expressive enough to do things that are easy in a dynamic language, and even if it were, you'd still have to write everything twice: once in the real language, and once again in the type language. And then you still have to test, don't pretend y…
Hmm, no I don't? Actually, 99% percent of the time I'm writing haskell, I can just write it like it's a dynamically typed language and the compiler/lsp will just say "Hey, I can see this is an int/string/list/whatever, want me to annotate that for you"?
Hindley–Milner type systems are way way too powerful and I can count on my fingers how many times the compiler was confused when inferring types and I had to manually annotate it.
And yes, of course I have to test the logic of my code. What I don't have to test is that my code behaves when given wrong-type values and that all the code calls functions with values of the correct type, because the compiler is doing that for me.
Re: Erg: a statically typed language that is Python compatible
#75Earlier quoted context omitted.
Why so averse to direct Python?
Slightly related question: why do people love Python so much? Or, any dynamically typed language? There's almost nothing that has frustrated me more in a professional setting than trying to figure out what some dynamically typed code is doing and ensuring I don't break anything by making changes.
Python's internals are also relatively accessible and easy to work with, so it's smooth sailing once you have that need. The language starts out easy, and grows with you. Of the languages I've tried (and there are many), only Smalltalk and the Lisp family were comparable in expressiveness.
The language mostly gets out of my way and lets me do what I want. I don't feel like I have to fight the compiler (at least until I tried Mypy) or write a lot of tediously verbose boilerplate just to get out a "Hello, World!" like I did in Java.
Unlike, say, JavaScript, Python is pretty strongly typed and fails fast. The stack traces almost always point you to the exact location of the problem (unlike the JS tendency to propagate `undefined` everywhere). There aren't a lot of surprises or gotchas. I can pretty much run it in my head just by reading the code and be right most of the time. I cannot say the same for C++ or JavaScript, which naturally tend to become inscrutable without discipline.
Re: Erg: a statically typed language that is Python compatible
#76Earlier quoted context omitted.
Slightly related question: why do people love Python so much? Or, any dynamically typed language? There's almost nothing that has frustrated me more in a professional setting than trying to figure out what some dynamically typed code is doing and ensuring I don't break anything by making changes.
I believe dynamically typed languages are easier to use than old-style statically typed langages (Java, C, etc). More modern statically typed languages can be quite easy to use (I am thinking of Scala) but none provides an ecosystem as rich as python's. Plus, recent static languages (Scala, Rust, Haskell or even Elm) are more oriented toward "Software Engineers" or CS academics. Python appeals to a lot of "programmer…
Re: Erg: a statically typed language that is Python compatible
#77Earlier quoted context omitted.
I wrote typedload before pydantic was a thing. It's faster and actually works well with mypy and python's type system. Pydantic requires inheritance and requires a modified mypy because it uses types its own way rather than the python way. Oh, typedload is faster than pydantic, despite being pure python instead of an .so file.
I would be very interested in seeing some benchmarks! I'm pretty sure that serde, the rust library that Pydantic uses, is faster than the JSON parser written in C in the python standard lib, so I'd be very surprised if your pure python validation library beat pydantic.
At the bottom there are instructions on how to run the benchmark locally.
Re: Erg: a statically typed language that is Python compatible
#78Earlier quoted context omitted.
Why so averse to direct Python?
Slightly related question: why do people love Python so much? Or, any dynamically typed language? There's almost nothing that has frustrated me more in a professional setting than trying to figure out what some dynamically typed code is doing and ensuring I don't break anything by making changes.
Re: Erg: a statically typed language that is Python compatible
#79It would be nice if someone created a typescript for python. Something that allows us to wrangle control and sanity over reams of legacy untyped python madness.
Re: Erg: a statically typed language that is Python compatible
#80Earlier quoted context omitted.
And static languages introduce a whole class of issues that dynamic languages don't have to deal with. You have to learn a separate metalanguage just for the types that isn't expressive enough to do things that are easy in a dynamic language, and even if it were, you'd still have to write everything twice: once in the real language, and once again in the type language. And then you still have to test, don't pretend y…
>you'd still have to write everything twice: once in the real language, and once again in the type language Hmm, no I don't? Actually, 99% percent of the time I'm writing haskell, I can just write it like it's a dynamically typed language and the compiler/lsp will just say "Hey, I can see this is an int/string/list/whatever, want me to annotate that for you"? Hindley–Milner type systems are way way too powerful and I…
I'm mostly complaining about static typing in the style of Mypy/Pyright and Java (and half of Scala, the other half is like Haskell). You know, the static typing one is likely to encounter in industry. But even Hindley-Milner isn't as expressive as fully dependent types like Agda or Idris. If you're going to use static typing at all, why not go all the way?