-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
thoughts for Mojo🔥 lang? static performance oriented py-superset #2459
Comments
As best I can tell, you're asking for Hy to support Mojo. Insofar as Mojo is a different language from Python, this is out of scope. Insofar as it's merely another implementation of Python, this should be covered under #934. |
well, it's a different language in development which aims to be fully compatible with existing python source files. It is a superset of python - just like typescript is to javascript. like i said, the |
my thought was that - as hy converts sources to python - it will technically be possible to be able to make some additions to hy & being able to generate the corresponding mojo code so, it will provide the expressiveness & consistency of hy while being more performant on demand. |
As a(n important) nitpick, the Hy compiler compiles Hy sources to Python AST, which is a level or two below source code. Mojo is not yet open source, so I have no clue whether they're parsing Mojo source to (an extension of) Python AST or something else. |
hi @ scauligi ! thanks for ur input and clarification. so, do u know of any way to get any static typing or pure functional nature with python/hylang? |
Unfortunately all the Python type checkers I'm aware of seem to be syntax-based, and so wouldn't work with Hy. For "pure-functional" coding, depending on your needs, I think defining "frozen" dataclasses using attrs will work quite well. |
It's supposed to be 100% accurate. Do you have any examples of "ASTs one can create with Hy that cannot be represented by Python source"? 'Cause that's a bug. |
I meant it in terms of weirdness like >>> weird = Module(body=[Assign(targets=[Name(id='with', ctx=Store())], value=Constant(value=3))], type_ignores=[])
>>> ast.unparse(weird)
'with = 3'
>>> with = 3
╭─────────────────────────────────────────────────╮
│ with = 3 │
│ ▲ │
╰─────────────────────────────────────────────────╯
SyntaxError: invalid syntax |
I went to some lengths to make sure Hy only emits Python-legal names, though (af64cbe). If you can still get it to produce |
Admittedly, python/cpython#90678 is itself a bug (which it seems will never be fixed, since my PR has sat unreviewed), but that's why we have the workaround. |
ohw, wow. i don't think that is good approach at all. but more power to you i would have prefferred having involving using some namespace like concept i.e. say mandatorily requiring some macro: to handle that mangling and put restriction on syntax, |
Titles:
Why Mojo🔥
my extracted summary (click me)
A language for next-gen compiler technology
A member of the Python family
Mojo🔥
my summary of why it felt important to me
borrowed
andinout
Syntactic additions
my extracted list which i think would need any changes in
hy
translator, so, E&OEfn
strict function definitionslet
(rt constant) andvar
(rt value) declarations inside adef
;alias
(compile-time value)struct
Int
,Bool
,String
, andTuple
@value
decoratorThe text was updated successfully, but these errors were encountered: