Replies: 2 comments
-
This limitation obviously has big implications for the language down the road, since it locks comparison and arithmetic operators to those specific base types. somehow we would have things like |
Beta Was this translation helpful? Give feedback.
-
Feel free to file an issue for a Size type (probably more accurately called Note: being able to define your own types that are used like this would require extensions as well as operator overloading. Generally, we are hesitant to add new language features for the fear of making the language too complicated; Pkl should be easy to learn and use. Also, extension methods are challenging for interpreted languages because variable resolution happens at runtime (you pay the cost of the lookups every time you eval the program, versus once during compilation). |
Beta Was this translation helpful? Give feedback.
-
I was reading the Number definition and seems like all the units like
Duration
andDataSize
are intertwined in there.I used the same logic from there, excluding the
external
keyword:but the magic of
10.mm
is not accessible to me.I must admit if this is really the case and only certain units defined by the language maintainers are to be then it's a really disappointing design decision to see. Units should be completely abstracted and kept separate or not exist at all.
Beta Was this translation helpful? Give feedback.
All reactions