4 ms·
"The language doesn't even have the concept of null!" <-> is_null [1] [1]: https://github.com/CausalityLtd/ponyc/search?utf8=%E2%9C%93&q=is_null https://github
by teamhappy 11y ago
"The language doesn't even have the concept of null!" <-> is_null [1]
[1]: https://github.com/CausalityLtd/ponyc/search?utf8=%E2%9C%93&q=is_null https://github.com/CausalityLtd/ponyc/search?utf8=%E2%9C%93&...
Also, your 3-clause BSD license only has two clauses.
- barrelrider 11y agoOne class having a method called "is_null" doesn't mean that the language has null built into it or any inherant concept of what that means. Just like having a method called "is_functional" doesn't mean it's a functional language.
- thinkpad20 11y agoLooks like the `handle` in question there in the File module is an instance of a Pointer, which presumably is some sort of wrapper around a raw pointer. It has null in the sense that the pointer can be null; this isn't the same thing as how nulls are traditionally used (e.g. an "empty object" which can appear in the place of where an actual object might be). So it's not a language level concept.
- Nycto 11y agoHmm. This feels a bit pedantic to me. The `is_null` check looks relegated to the FFI: https://github.com/CausalityLtd/ponyc/blob/975d9f6c60553030e623a7eb27f1caa6eebb80ec/packages/builtin/pointer.pony https://github.com/CausalityLtd/ponyc/blob/975d9f6c60553030e... Obviously, I have never written anything in Pony, but this absolutely seems like an advanced use case. It exists because 'C' has a concept of null, so it needs to be handled. The manual even admits that all bets are off when dealing with the FFI.
- ShaneWilton 11y agoIt's also worth noting that the language does have a None primitive, but the distinction from nil or null is that the concept of "nothing" is wrapped in it's own type entirely. This means that it would be a type violation for a method of return type String to ever return a None. Instead, a method that you expect to return a String or a None would need to have a union return type of (None | String). It's analogous to Maybe, in Haskell.