Live data from Hacker News

Show HN: Mys – an attempt to create a statically typed Python-like language

github.com

11–20 of 57 posts

Re: Show HN: Mys – an attempt to create a statically typed Python-like language

#12
post #5

Given that the OP is the github project owner, are you aware of https://chocopy.org/ ? You might want to also look at Shedskin, https://github.com/shedskin/shedskin which converts implicitly typed Python programs to C++

No, I am not aware of ChocoPy. Thanks for letting me know.

Shedskin uses the Python interpreter if I remember correctly. I aim not to.

Re: Show HN: Mys – an attempt to create a statically typed Python-like language

#13

Question for the OP seeing as this is a Show HN: how does this compare to Nim ( https://nim-lang.org/ )?

Not OP, but a big Nim fan. I think Nim has made a mistake by marketing itself as Python inspired. I know why it does so; Python is a very successful language and as a niche language, Nim wants to associate itself with an established one. But in my experience, Nim has a very small overlap with Python. It is whitespace significant, prefers short words to symbols for operators, and has a robust stdlib. But if you look at the actual language semantics, or even the keywords, Nim is not really related to Python. I'd go as far as saying Nim is more similar to a Lisp than it is Pythonic (which works fine for me, as I prefer Lisp to Python).

All of this to say, the OPs language seems much more Pythonic. The key words, the built in functions, the class system, all seems designed to match Python as closely as possible.

Re: Show HN: Mys – an attempt to create a statically typed Python-like language

#14
post #3

I am working on something similar, although with a different focus (mobile coding): https://github.com/stefanhaustein/tantilla P.S.: Might make sense to try to get to a common type-safe language spec?

Nice job.

I don't understand the question. Can you rephrase it? =)

Re: Show HN: Mys – an attempt to create a statically typed Python-like language

#15
post #9

This looks cool. Is there anything specific you're trying to do with Mys that another language didn't do? Nim comes to mind as being in a similar space. Small nitpick about the title: Python is strongly typed.

I would call Python untyped

You would be wrong. Try adding a string and number together. That's a type error. Unlike in JS or C, where a lot of these conversions are implicit and only warn if anything.

Python determines the types at runtime, but it is very clear about what few operations you're allowed to do on any given set of types.

Re: Show HN: Mys – an attempt to create a statically typed Python-like language

#16

This looks cool. Is there anything specific you're trying to do with Mys that another language didn't do? Nim comes to mind as being in a similar space. Small nitpick about the title: Python is strongly typed.

Well, probably not. Nim is similar, but I prefer Mys' Python-like syntax. Mys' toolchain will probably be similar to Nim. That is, generating C/C++ code.

Sorry about the confusion. Mys is statically typed. I changed the HN post from strongly to statically to make it clear.

Re: Show HN: Mys – an attempt to create a statically typed Python-like language

#17
post #14
post #3

I am working on something similar, although with a different focus (mobile coding): https://github.com/stefanhaustein/tantilla P.S.: Might make sense to try to get to a common type-safe language spec?

Nice job. I don't understand the question. Can you rephrase it? =)

It might make sense to try to support the same subset of Python in both projects. On the other hand, this might make experimentation harder... And there seem to be many differences, for instance I am trying to move towards async/await... But there might also be areas that could be easy to get consistent, e.g. how local variables are declared...

p.s. And I wasn't aware of Cocopy either. Having a list of similarities and differences of all three might be useful...

Re: Show HN: Mys – an attempt to create a statically typed Python-like language

#19

Question for the OP seeing as this is a Show HN: how does this compare to Nim ( https://nim-lang.org/ )?

Not OP, but a big Nim fan. I think Nim has made a mistake by marketing itself as Python inspired. I know why it does so; Python is a very successful language and as a niche language, Nim wants to associate itself with an established one. But in my experience, Nim has a very small overlap with Python. It is whitespace significant, prefers short words to symbols for operators, and has a robust stdlib. But if you look a…

It took me a couple of weeks to realize Nim’s semantics are really different. Despite that Nim feels like an alternate reality of Python 2 -> 3 that went more lispy and a bit Pascal-ish. It gives me the old Python 2.7 vibe. Though I’d still prefer ‘def’ to ‘proc’ but that’s pretty minor to me.

It’s interesting to see how well the typed Python syntax maps to a static implementation of Python. The speed should probably be a lot faster than CPythin too for many cases.

Re: Show HN: Mys – an attempt to create a statically typed Python-like language

#20
post #10

Question for the OP seeing as this is a Show HN: how does this compare to Nim ( https://nim-lang.org/ )?

It's a wide question, and I don't have a good answer. One obvious difference is the syntax. I prefer Python's syntax over Nim's, but at the same time I find Python slow sometimes and hard to use in embedded systems. I'm aiming to create something similar to Nim's toolchain to address that.

P.S. Since you’re using C++ shared pointers, you might want a cycle detection. But like Nim’s new ARC you can let the programmer beware and ensure their programs don’t produce cycles. It seems handy to allow pure RC’ing for embedded devices.
Post reply on HN