Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's so much overlap between the Wirth languages that I am not surprised about that. What specifically comes from Modula-3, though?

I didn't know that Python was influenced by Modula. Any examples? Keyword arguments is the only that comes up on Google.



> What specifically comes from Modula-3, though?

Off the top of my head, the equivalency of "foo.bar(baz)" and "bar(foo, baz)" was inspired by Modula-3's object model, though Nim extends it to everything and not just classes. Also, Wikipedia tells me the pointer system comes from Modula-3.

Nim's official FAQ also lists Modula-3 as the single biggest influence; I have a feeling that a lot of the Wirth-isms in Nim were borrowed from Modula-3 rather than from Pascal, even if they appeared in both languages.

> I didn't know that Python was influenced by Modula. Any examples? Keyword arguments is the only that comes up on Google.

Off the top of my head:

- The module system. The syntax of "import foo" and "from foo import bar" were borrowed from Modula-3 verbatim, and Guido got the idea to give Python a module system in the first place because Modula-3 convinced him modules were the future.

- The exception system. A lot of people don't notice the exception system because pretty much every language in the '90s also borrowed that from Modula-3 (the try-catch paradigm was invented by Modula-3), but Python hews even closer to the Modula-3 model by using the word "except" instead of "catch" and allowing for multiple except blocks attached to a single try block.

- The object system is a hybrid of Modula-3 and C++; the whole idea of passing "self" as the first parameter to a method instead of having an implicit "this" was a Modula-3 thing. The official Python documentation still references it: https://docs.python.org/3/tutorial/classes.html

Guido also talks about the Modula-3 influence in a few places:

https://docs.python.org/3/faq/general.html#why-was-python-cr...

http://www.artima.com/intv/pythonP.html


Hm, is this official, or are you deducing this from similarities?

I wish Andreas Rumpf were here to comment and hopefully correct me, but I believe he was formerly an ObjectPascal/Delphi programmer. The first version of the Nim compiler was written in Borland's ObjectPascal dialect (see http://nim-lang.org/docs/intern.html), which has some of the same features as Modula, but with a slightly more circuituous lineage, since it was originally based on Apple's Object Pascal, a dialect which Wirth was tangentially involved in designing. (Object Pascal predates Modula-3, too.) In that sense, some of the similarities are probably accidental or caused by cross-pollination (for example, Borland probably took the exception handling syntax from Modula). That's the problem of trying to infer lineage by looking at similarities alone.

The unified call syntax sounds like it might be lifted directly from Modula, though.

Thanks for the Python trivia, I didn't know that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: