Live data from Hacker News

Erg: a statically typed language that is Python compatible

github.com

151–160 of 194 posts

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

#151
post #150
post #98

Earlier quoted context omitted.

What i don't like about python: The goddamn versioning and packaging problems. About 5 years ago python was incredible. You could pop out a project quickly because there were very few packages that made breaking changes over their development, so you could often use your standard workflow with the set of packages you we're comfortable with, even if there were new versions available that day. Now, Nvidia and Google ru…

Using virtual environments solves this issue: https://docs.python.org/3/tutorial/venv.html

This is simply not the case. It works sometimes. Maybe. In many cases (software that is, say, a few years old) you run into packages that aren't available for a certain version. After trying various combinations of pip, maybe even easy_install, and poetry - to come up empty handed, you may realize you need some old library such as qt4, where pypi will certainly not work. So when poetry or pip doesn't work and pypi doesn't have your specific old version, you may try mamba/conda/ micromamba conda-forge. But these also probably don't have it either, and your stuck trying to compile old versions in a docker, which still is not guaranteed to work.

There's a reason that package dependency keeps getting rewritten in python. People think they can make it better, but some of the problem is actually just the developer choices by people making the packages. Probably the price paid for having too many people using the language who aren't actual software developers.

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

#152

Earlier quoted context omitted.

fully agree with you. the downvotes must be by Python fanboys seething in their indented whitespaces.

I'm not a Python fan at all but still see much value in clean, DRY syntax. Significant whitespace is a huge success even in languages that switched to it late! Almost nobody in the F# or Scala¹ community would consider to switch back to that unnecessary line noise which are explicit block markers. Code should be indented for readability anyway (and almost nobody would dispute that)! So there is just no real value in…

per se, I don't mind the white spaces--but I don't want to be forced to use them. Like what you see in Julia, or Kotlin. Code is poetry. I should be trusted to organize my code according to how it reflects what it reflects.

I dislike block markers as much as forced white-space, because there is lack of freedom. I understand that this was done so that different people could easily read legacy code but I don't think this helps because despite Python zen, there way too many ways to do the same thing. Why not allow the programmer to get creative so that at least the code is elegant? Elegance is highly readable.

---

BTW: I think a good mechanism would be: "do not reward if it is not worth it" and "reward if it is." But the Fascist aspect here is: "punish if it is not worth it." Who decide what is worth what? Opinions vary. If everybody thinks alike, nobody is really thinking. Answers that earn higher points may be attractive to a majority of people, but you well know that the majority are of average intelligence (IQ is normally distributed). So mediocre quality gets upvoted, anything the mediocrity-loving majority doesn't, gets downvoted. Makes sense? The intelligent people I refer to are those who like me, question, probe, disagree, and dare to say it like it is. :) That does not mean the majority.

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

#153
Another languages which compiles down to Python is Haxe https://haxe.org/manual/target-python-getting-started.html

If you want to use static typing with c ES6 like syntax, Haxe is amazing. Haxe also compiles down to a half a dozen more compiler targets - including C++, C#, Flahs (via OpenFL), lua etc.

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

#155
post #115

Earlier quoted context omitted.

Mypy is basically that. https://github.com/python/mypy

Also note that while this repo might look like a third party bolton (it started that way), the type hinting syntax is nowadays actually integrated in the language. The only thing you need to do is add appropriate type hints at function definitions and then run mypy in your build and CI and you got something that checks basically as strict as Java. For those saying it’s optional so can’t be trusted, consider that comp…

Pylance in VSCode also errs on type mismatches.

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

#156
post #134

Earlier quoted context omitted.

Also, the UB can be mitigated with -fwrapv (if desired) to handle overflowing integers with 2's complement

Stupid question, but how can a compiler flag "mitigate" some UB that is (to my knowledge) defined by the standard as UB? This would be possible only if the standard would define the behavior in question as implementation defined. But that's not the case afaik. Signed overflow is undefined behavior as it's afaik defined to be that. But maybe I'm just wrong here? But at least SO is confining my knowledge: https://stack…

-fwrapv forces the compiler to handle signed overflow with 2's complement. UB essentially means the compiler is free to do anything, and with the option it chooses the wrapping behavior. See https://stackoverflow.com/questions/47232954/what-does-fwrap...

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

#157
post #125
post #89

Earlier quoted context omitted.

Python is among the least-readable languages for me. The lack of whitespace and brackets around code blocks just make it look like the "wall of text" that everyone hates in emails. And then there's the fact that Python has significant characters that are literally unreadable because they're invisible (semantic whitespace).

And yet I notice that you separated the paragraphs in your post using semantic whitespace rather than "BEGIN PARAGRAPH" / "END PARAGRAPH" or something similar, and it seems perfectly readable to me.

> separated the paragraphs in your post using semantic whitespace

That's not what "semantic" means.

In my post, the size of the whitespace was not semantic. I could have used one spaces, two spaces, tabs, or (as I did) a couple of newlines. All that matters is that there was any whitespace at all -- which is what most mainstream languages do.

In Python, the whitespace I chose would change the actual program.

To repeat: I do not want anything that is literally invisible to change my program. It's easy to glance at code and see "=" vs "==", but it's much harder to tell the difference between " " and " ".

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

#158

Earlier quoted context omitted.

> There's no difference between a mypy-enabled codebase and a java codebase in terms of static typing (other than that mypy actually supports a generally richer type system). that must require some advanced usage of mypy then, because my experience was that even the most simple example got the finger from mypy that would have very obviously worked in Java mkdir alpha echo 'beta = True' > alpha/models.py echo 'from .m…

It's imho especially ridiculous to say some linter, that needs "hints" and annotations everywhere, is comparable to a static type system when looking at modern static languages, which have usually very strong type inference . The point of a sound static type system is that you get a guaranty that your program is type-safe even in case not everything is "hinted properly". With the linter approach on the other hands si…

Did you reply to the right person? I'm with you, friend :-)

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

#159
post #89

Earlier quoted context omitted.

Python is among the least-readable languages for me. The lack of whitespace and brackets around code blocks just make it look like the "wall of text" that everyone hates in emails. And then there's the fact that Python has significant characters that are literally unreadable because they're invisible (semantic whitespace).

You can add empty lines before and after blocks. The only thing that matters is the indentation. If you see code without empty lines separating different steps, that's pretty badly written Python.

> If you see code without empty lines separating different steps, that's pretty badly written Python.

You're describing literally all of the Python I've ever seen. Look at Flask, for example[1].

Furthermore, without brackets, adding newlines in a code block forces me to then add more newlines between blocks (which Flask also does!)

I would rather just have easy-to-scan, clear characters that demarcate a code block.

1. https://github.com/pallets/flask/blob/main/src/flask/templat...

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

#160
post #150
post #98

Earlier quoted context omitted.

What i don't like about python: The goddamn versioning and packaging problems. About 5 years ago python was incredible. You could pop out a project quickly because there were very few packages that made breaking changes over their development, so you could often use your standard workflow with the set of packages you we're comfortable with, even if there were new versions available that day. Now, Nvidia and Google ru…

Using virtual environments solves this issue: https://docs.python.org/3/tutorial/venv.html

I don't know if this is off topic, but I cannot describe the amount that I miss the joy of `python -m venv` in other dynamic languages like ruby. I'm sure there are 100 different tools on github that claim to fix it, but "There should be one-- and preferably only one --obvious way to do it." makes me feel safe in trying out new conflicting libraries in a disposable environment
Post reply on HN