Live data from Hacker News

Erg: a statically typed language that is Python compatible

github.com

31–40 of 194 posts

Re: Erg: a statically typed language that is Python compatible

#31

Not sure why I'd want to use this, presuming I was already happy with python. Especially now that python's type hinting is more mature. Looking through the feature set the main thing it seems to provide is a type system, but with a syntax I don't like as much as python's type hinting.

[deleted]

Re: Erg: a statically typed language that is Python compatible

#32
post #4

Earlier 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.

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 libraries that came from somewhere.

It's the community. Network effect looms large.

While typing is dynamic, I rarely see this being used, perhaps with the exception of identifying empty variables with None. Most identifiers are born and die the same type. It would be interesting to see how much effect dynamic typing has on the rate of programming errors.

Also, for me, Jupyter is huge.

Re: Erg: a statically typed language that is Python compatible

#33
post #4

At this point I'm open to try anything that will give me access to the python ecosystem without having to code in Python. From the FAQ it looks like Erg code gets transpiled to python bytecode.

Why so averse to direct Python?

For me:

* Download and just run doesn't work. (e.g. Node, dotnet, cargo do this well). Hell, I've generally had more success with C++ in this regard.

* The syntax can be used in an extremely terse way, and that terseness seems to be idiomatic.

Re: Erg: a statically typed language that is Python compatible

#34

Not sure why I'd want to use this, presuming I was already happy with python. Especially now that python's type hinting is more mature. Looking through the feature set the main thing it seems to provide is a type system, but with a syntax I don't like as much as python's type hinting.

This is sort of speculation on my part: The fact that static typing PEPs can't easily introduce syntactic changes to the language (I don't think there has been a syntactic change introduced because of static typing ever since Python 3.5) will really hold back Python's static typing from being ergonomic at least, and "fully capable" at the worst. I think that limitation of statically typed Python alone is enough to gi…

I was just playing around with Python 3.10 for the first time today. I made an algebraic/sum-type (dataclasses + typing.Union), then did some structural pattern matching on a value of that type (match statement), and Mypy could tell me statically when the pattern matching wasn't exhaustive!

I think it's pretty damn amazing how well Python has been able to evolve into the realm of static typing. And no unofficial superset syntax required!

Re: Erg: a statically typed language that is Python compatible

#35

At this point I'm open to try anything that will give me access to the python ecosystem without having to code in Python. From the FAQ it looks like Erg code gets transpiled to python bytecode.

I don't see how it can though - at least it can't do it in a statically typed way because half of the Python ecosystem hasn't bothered with static types and the semantics of the type hints that do exist isn't defined.

So you'll end up with everything you import being `any` which is not really any better than just using Python.

Re: Erg: a statically typed language that is Python compatible

#36
post #34

Earlier quoted context omitted.

This is sort of speculation on my part: The fact that static typing PEPs can't easily introduce syntactic changes to the language (I don't think there has been a syntactic change introduced because of static typing ever since Python 3.5) will really hold back Python's static typing from being ergonomic at least, and "fully capable" at the worst. I think that limitation of statically typed Python alone is enough to gi…

I was just playing around with Python 3.10 for the first time today. I made an algebraic/sum-type (dataclasses + typing.Union), then did some structural pattern matching on a value of that type (match statement), and Mypy could tell me statically when the pattern matching wasn't exhaustive! I think it's pretty damn amazing how well Python has been able to evolve into the realm of static typing. And no unofficial supe…

That's wonderful to hear! It's been > 1 year since I used daily-drove Python, so my comments do lag behind the progress by at least a year. Maybe an unofficial superset syntax is indeed not required!!

Re: Erg: a statically typed language that is Python compatible

#37
post #4

Earlier 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.

>ensuring I don't break anything by making changes

I think this is a problem in both static and dynamic languages and is pretty much solved in the same way: you test your code.

Re: Erg: a statically typed language that is Python compatible

#38
post #4

Earlier 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.

- Huge ecosystem.

- Common stuff (opening files, dealing with databases, string processing, math, regexps) is very easy. Sane defaults.

- Works well with the existing C ecosystem. It's not a "rewrite everything in X" language.

- It's everywhere, most machines run Python just fine.

- It doesn't treat Windows like a second-class citizen.

- It doesn't force upon you a programming model that you might or might not care about. It's not a puzzle language where everything is a monad, or everything is a class, or everything is some weird widget. Write the damn code.

- I'm personally not a fan of the language itself, but it's mostly a bog-standard algol if you don't poke it too much. It's relatively standard, people just get it even if Python isn't their main language.

- Very personal point, but it's the only language I can edit with a plain text editor. Think nano, vi, Windows Notepad, that kind of thing. I don't know what to tell you, maybe it's my tiny monkey brain, but I can't do the same in Java or C++. Not that it's my preferred way to edit software, but I like having that option in a pinch.

At least for what I do (developer, but with a data engineering/data science flavor) the overall architecture is usually the important thing, so admittedly some downsides might hit me less.

I'd still rather write medium-to-large pieces of software (say 10,000+ LOC) in something else (Java, C#, C++, something boring like that), but it's pretty much unbeatable for small programs as far as I'm concerned.

Post reply on HN