modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
22.85k stars 2.58k forks source link

[Feature Request] Align Mojo `alias` with `type` #3367

Closed redradist closed 2 weeks ago

redradist commented 1 month ago

Review Mojo's priorities

What is your request?

In Python 3.12, there is a new use of type keyword, Type Aliases. I suggest to align alias keyword with type in favor of type in Python

What is your motivation for this change?

Make better interchangeable between Python and Mojo code

Any other details?

No response

martinvuyk commented 1 month ago

The problem is that this would conflict with alias being used to setup compile time constants as well, not just types.

Mogball commented 2 weeks ago

alias is the more general names of the two. It could be confusing, for example, to write type g = 123 (even though Python allows using ints as types, linters aside)