Re:Codon: A high-performance Python-like compiler using LLVM
by insanitybit on Friday December 09, 2022 @12:23PM
(#33923931)
Because mixing types in an array is stupid enough that I thought it might just not be valid.
[ Parent
| on HN ]
Re:Codon: A high-performance Python-like compiler using LLVM
by ris on Friday December 09, 2022 @02:49PM
(#33925705)
Mixing types in an array/list is not remotely stupid. How exactly would you suggest expressing the lack of a value in a series of numbers without None/null? There's your mixed types.
Don't let weird dogma get in the way of practicality.
Re:Codon: A high-performance Python-like compiler using LLVM
by qwefsdf on Friday December 09, 2022 @05:52PM
(#33927500)
That's an Optional[int]. It's not "mixed types", it's a union type.
Re:Codon: A high-performance Python-like compiler using LLVM
by ris on Sunday December 11, 2022 @08:03AM
(#33942802)
That is merely a detail of how the typing module has decided to set up convenient aliases. Treated by the language (and likely compilers) as different types.
Re:Codon: A high-performance Python-like compiler using LLVM
by insanitybit on Friday December 09, 2022 @05:35PM
(#33927310)
JSON has a `null` value already, and null is its own special case in most languages where `null` is a universal type.
Otherwise you tag your data so that it's an array of objects.