Type | Wish | Status | dismissed | Date | 17-Mar-2015 02:11 |
---|---|---|---|---|---|
Version | r3 master | Category | Unspecified | Submitted by | fork |
Platform | All | Severity | minor | Priority | normal |
Summary | Adopt Lone Underscore _ as a literal NONE! |
---|---|
Description |
Literal NONE! has a fair amount of value, and is easily motivated by cases where an "optional" or "match anything" placeholder slot is needed. For instance, consider: foo: function ['x [none! word!] y [block!]] [...] You run into trouble with `foo none [...]`. It is possible to write `foo :none [...]` or use other construction forms, but this seems both inelegant and like an accident waiting to happen. A convenient literal NONE! has many benefits, and being a single character is a virtue. In fact, there currently is a literal NONE! in both Rebol and Red. When ISSUE! was changed from an ANY-STRING! to an ANY-WORD! in Rebol3, the dislike of the existence of an empty-string ANY-WORD! motivated the decision that a lone # be interpreted as a literal NONE!. >> type? load "#" == none! Putting aside the question of whether it should be legal to write `to-issue {}` for purposes this ticket, the larger question arising from `#` taking on such a role has to do with "stickiness to asymmetric delimiters". # already wears a lot of hats, and if some of those hats like `#(...)` or `#[...]` are being given meaning distinct from `# (...)` and `# [...]` then that can be seen as a bad thing by some people (I'm one of the people who sees that as bad) The lack of interest over `_(...)` and `_[...]` taking on some unique meaning suggests that perhaps, in the lexical universe, that a lone underscore might be a good candidate for the "blank". There is precedent in Haskell for "wildcard" or "placeholder". Underscores are rather uncommon in Rebol identifiers anyway. The use of an isolated one to mean literal NONE! might be good, and to leave a lone `#` as an error. |
Example code |
Assigned to | n/a | Fixed in | - | Last Update | 23-Mar-2015 22:39 |
---|
Comments | |
---|---|
(0004613)
fork 23-Mar-2015 22:39 |
Closing this random thought (better ideas are available now allowing # as literal none to continue without ambiguity) |
Date | User | Field | Action | Change |
---|---|---|---|---|
23-Mar-2015 22:39 | fork | Status | Modified | submitted => dismissed |
23-Mar-2015 22:39 | fork | Comment : 0004613 | Added | - |
17-Mar-2015 02:37 | fork | Description | Modified | - |
17-Mar-2015 02:11 | fork | Ticket | Added | - |