mys-lang / mys

The Mys programming language - an attempt to create a statically typed Python-like language that produces fast binaries. See https://mys-lang.org for more information.
Other
132 stars 5 forks source link

Hello from Shedskin #3

Closed pfalcon closed 4 years ago

pfalcon commented 4 years ago

In the vein of #1.

README:

All variables must have a known type at compile time. The same applies to function parameters and return value.

With limitations like that, and AOT nature, the closest no-NIH project doing that is Shedskin. Except that of course it's not as primitive as Mys [currently], but performs type inference. (But yes, it requires each variable to resolve to a single type, which is a usual limitation of a simple AOT approach, and why most projects use JIT.)

eerimoq commented 4 years ago

Hi!

Yeah, Shedskin looks nice. Unfortunately the project is inactive and does not support Python 3. Maybe I should put time into that project instead of Mys, but I don't know enough about Shedskin to know if I like it, and at the same time I enjoy designeng Mys. :P

pfalcon commented 4 years ago

Unfortunately the project is inactive and does not support Python 3. Maybe I should put time into that project instead of

Yeah, Shedskin definitely waits for its hero to upgrade it to Python3. Well, there's a patch: https://github.com/shedskin/shedskin/pull/261 , but it's too big to assess how good it is (so, eyeballing it, I figured that to review it, I'd need to re-do it from scratch).

but I don't know enough about Shedskin to know if I like it,

You can have a look at docs (https://shedskin.readthedocs.io/en/latest/) and examples (https://github.com/shedskin/shedskin/tree/master/examples) and see how soon you'd arrive at the similar state.

For a set of a 75 non-trivial programs (at over 25,000 lines in total (sloccount)),
measurements show a typical speedup of 2-200 times over CPython.

and at the same time I enjoy designeng Mys

Sure, writing a compiler for C-like subset of Python is very easy, and thus encouraging and self-assuring. A kind of above-average programmer's analog of bubble wrap popping. A recent example I saw before this one: https://github.com/windelbouwman/corepython .

The problem is that no realistic existing Python program fits in C-like syntax/semantics, so such a compiler unlikely will be usable on existing code. And if writing code from scratch, it might occur that the best language to write C-like code is ... C. (Of course, everything relative, nowadays many people disagree and think that the best language to write C-like code is Rust.)