5 ms·
The very first entry in the FAQ ("Why is none used instead of null?") isn't very convincing! It says null "it isn't friendly to normal people who might be given
by iainmerrick 9y ago
The very first entry in the FAQ ("Why is none used instead of null?") isn't very convincing! It says null "it isn't friendly to normal people who might be given configuration or message files to edit," and gives the example:
Children: none
Opinions: none
That certainly looks pleasant and human-readable, but a bit of a nightmare to interpret! Couldn't it just as well be "Children: 0" or "Children: []"? If the idea is to let non-technical people edit configuration files, the code reading the file will have to be very flexible and forgiving.
(Edit to add: maybe that's something you mostly get for free in REBOL? It would be a major headache in most other languages though)
- hood_syntax 9y agoValid points about the ambiguity in that example, but I do believe 'none' is easier to parse than 'null' for the average person. I'm assuming that none is meant to represent, like null "no input was given" not "an input of zero/an empty list was given".
- vorotato 9y agoalso "Some | None" is a common functional programming idiom.
- amyjess 9y agoIt's worth mentioning that Python refers to null as None.
- mh-cx 9y agoBut in that case, wouldn't “unknown“ be even better? I'm not a native english speaker, though, so I may miss some fine nuances in the meaning of “none“.
- hood_syntax 9y agoDisclaimer: this is just my personal views, so I may be missing something here. 'unknown' is almost like saying "We don't know what should be here", while 'none' is closer to saying "We didn't get passed any information here". Ultimately, I feel like 'unknown' is more specific, it conveys intent beyond that of 'none'. Such as, it could imply we actually don't know what kind of data 'Opinions' should hold, rather than that there merely happens to be no data to put there.
- greggirwin 9y agoWe can throw out options for a long time, as there is no perfect choice. Ren went with `none` as it is standard Rebol and Rebol's designer thought about it long and hard.
- jpfed 9y agoAs a native English speaker, I agree that "unknown" is better than "none".
- always_good 9y agoI would hope that a native English speaker knows the difference between Cookies in the jar: none and Cookies in the jar: unknown
- greggirwin 9y agoUnknown is a nice word for this, yes. And while we don't focus exclusively on being terse in the Redbol world, "unknown" is a lot more work to type than "none", harder to scan visually as well.
- deleted 9y ago[deleted]
- rebolek 9y agoYup, the right reason is, that `none` is free in Rebol/Red. Ren is basically nothing else than Rebol/Red syntax under different name. I was of the designers of Ren, it’s been few years, but it’s cool to see it on HN.
- greggirwin 9y agoNoted. Thanks.
- rgchris 9y agoNote that Ren-C (a fork of Rebol that is only tangentially related to Ren) uses `blank` or literal `_`. The language concept is a bit more fundamental than config files. Rebol (and Ren-C and cousin Red) is a fully homoiconic language that itself has tools for parsing and interpreting DSLs ('Dialects' to use the language's nomenclature) that use the same language rules. In essence you do indeed get the lexer for free. Would recommend a wee read of: http://blog.hostilefork.com/why-rebol-red-parse-cool/ http://blog.hostilefork.com/why-rebol-red-parse-cool/ I've argued that Ren is somewhat redundant as it fills the same space that Rebol does though Rebol lacks a formal specification at this time.
- greggirwin 9y agoWhich Rebol fills this space, R2 or R3? The idea was also not loadable Redbol compatibility (which would be nice of course), but general utility. So Ren adds new types and changes others, where it thinks that is best.