Live data from Hacker News

Erg: a statically typed language that is Python compatible

github.com

111–120 of 194 posts

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

#111
post #89
post #75

Earlier quoted context omitted.

Anecdote, but I like the Python community's emphasis on "readability counts". I did not get that from e.g. Ruby. 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 mos…

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

I never got the point against meaningful whitespace. It's indentation. You already indent blocks anyway; the only difference is that you don't need braces or begin/end.

I also did not understand your point about "lack of whitespace" around blocks. The only difference between blocks in Python and other languages is that the block start uses a colon instead of an opening brace and you don't have a line for the closing brace. Is that closing line such a big deal for you?

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

#112

Earlier quoted context omitted.

Because you can do a lot with little typing and there are lots of great libraries. Python is probably the best choice when you need to get something done quick or calculate something when performance is not important. It is also not an exotic functional language without loops and filled with linked lists. Also, in Python integers do not overflow, unlike in Rust, C and other buggy languages. If you name a language, wi…

Overflowing integers is not a bug. It's literally how an adder circuit operates on fixed precision. Ignoring them by default is worth criticizing but there are plenty of times where silent overflow is correct and desirable behavior.

> but there are plenty of times where silent overflow is correct and desirable behavior

When or where?

I would say it's always a bug in a program—except when (mis)using ints as bit-fields in very special circumstances.

Simply, as more or less every computation in the real world is build around the concept of whole numbers, and not around the idea of overflowing two-complement bit-fields.

The later is so exotic that there is afik almost no proper use for it (the only exception being as a very low level building block to enable computers do actually useful calculations).

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

#113
post #89
post #75

Earlier quoted context omitted.

Anecdote, but I like the Python community's emphasis on "readability counts". I did not get that from e.g. Ruby. 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 mos…

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

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

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

#114
post #109

Earlier quoted context omitted.

Overflowing integers is not a bug. It's literally how an adder circuit operates on fixed precision. Ignoring them by default is worth criticizing but there are plenty of times where silent overflow is correct and desirable behavior.

It's technically not a "bug" in Rust or C++, it's undefined behaviour , which is much worse than a bug! (and it's never correct behaviour)

Little nitpick:

In C/C++ it's "only" UB for signed ints.

For unsigned ints it's arithmetic modulo 2^n (where n is the number of bits in the value representation of that particular size of integer).

Such divergent definitions make the whole mess of course even bigger, that's not the point.

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

#115

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

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 compiling C++ with -Wall -Werror is also optional… adding it is simply part of standard project hygiene.

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

#116

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.

If your problem is with the runtime cost of python, do consider transpilers such as py2many that generate rust code. In order for this to succeed, python libraries would have to be rewritten without the C API in the dialect/subset of python supported. I wonder if erg could strive to use a subset of python mostly and innovate narrowly in just a couple of places to make python more functional.

it seems like their problem is the exact opposite to your suggestion

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

#118
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).

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 additional block markers. In fact such block markers make refactorings more difficult than needed.

¹ https://august.nagro.us/scala3-braces.html

___

BTW: Contrary to your opinion stated in your profile "subtracting points" for writing things the majority here disagrees with is not fascist in any way but exactly the mechanism that keeps the quality of the comments here high—which in turn attracts those "smart people hanging out here" (who you're praising) in the first place. ;-)

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

#119

Earlier quoted context omitted.

>There should be type hints. "Hey, this variable is probably of this type. Now go on, run the code and launch a debugger the same way you would if there was no hint just to make sure it's correct. Oh, and don't forget to check all the possible code paths that lead to this to make sure you've exhausted all possibilities." Don't get me wrong, type hints are cool but they're just a toy compared to proper static typing.

> Oh, and don't forget to check all the possible code paths that lead to this to make sure you've exhausted all possibilities." This is literally what mypy does. 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). Like yes if you aren't validating the type hints you aren't getting the value, but if…

The number of "# type: ignore" comments I've seen in all python codebases that use mypy seems to disagree. mypy is laughably primitive compared to advanced static typing systems: Rust, Haskell, OCaml, etc

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

#120

Earlier quoted context omitted.

Because you can do a lot with little typing and there are lots of great libraries. Python is probably the best choice when you need to get something done quick or calculate something when performance is not important. It is also not an exotic functional language without loops and filled with linked lists. Also, in Python integers do not overflow, unlike in Rust, C and other buggy languages. If you name a language, wi…

> Also, in Python integers do not overflow, unlike in Rust, C and other buggy languages. There is no such thing as a buggy language. Software can be buggy (or language implementation), but not the language. And the reason you do not have integer overflow is because integers are implemented as integer objects of arbitrary size, which is great if you're doing something quick and dirty, but could be disastrous for a ser…

> There is no such thing as a buggy language.

How can you know if you don't have a verified formal description of your language's semantics?

It's very much possible (and imho even quite likely) that a lot of language definitions are self contradicting.

Of course one could argue that such self contradictions aren't "bugs" at all. But such an argumentation would seem very odd, imho, no matter one can actually "define" whatever one likes.

Post reply on HN