Why do you prefer Int32
type-name instead of i32
(like it's in Rust) or int32
(numpy/pyarrow)
#96
Replies: 4 comments 8 replies
-
well just like in python |
Beta Was this translation helpful? Give feedback.
-
Coming from a language like Haskell, |
Beta Was this translation helpful? Give feedback.
-
Python types are generally capitalized. The type-annotations-for-objects are lowercase. We use names like "F32" and "Int" and "UInt8" as to make things more clear and not overly concise. For example, while "I8" is unambiguous, it isn't clear it is an integer, and we definitely cannot call "Int" just "I". :-) |
Beta Was this translation helpful? Give feedback.
-
Yes, arguably we should be using Float32 and Float64. The major difference is that we don't have "F" vs "Float" ambiguity like we would on the integer side of things. |
Beta Was this translation helpful? Give feedback.
-
Shorter is better...
|
Beta Was this translation helpful? Give feedback.
-
Hi! I don't really have any access to playground, but when I saw Mojo's docs - I've noticed that your team picked
Int8
(and probably something likeFloat32
) with first capital letters. In my opinion - this could cause somesocial
problems, because Mojo is python's superset and probably should follow some of the PEP rules (not all of them, ofc, but as much as possible). Python was always usedsnake_case
and even types should be lowercase.int32/float32
snake_case
) usei32/f32
that is also shortenAnd Mojo, IMHO, should have types like these too, just to correlate with other pythonic types, so the final look can look like this:
In this example we can see that all python's external modules uses fully-lowercase types and Mojo probably should use lowercase too.
So, my general question - is it possible to switch type naming from
PascalCase
to pythonicsnake_case
at this stage of Mojo's developing? (and why did you decided to usePascalCase
?)Anyways, thank you for you job! Great language with great goals!
Beta Was this translation helpful? Give feedback.
All reactions