Type | Wish | Status | pending | Date | 22-Mar-2013 04:36 |
---|---|---|---|---|---|
Version | r3 master | Category | Native | Submitted by | BrianH |
Platform | All | Severity | minor | Priority | normal |
Summary | TO-VALUE function to convert unset to none |
---|---|
Description |
I want a function that can take one normal parameter of any type, which returns that parameter unevaluated, except for an #[unset!] value. When it is passed an #[unset!] (or end! I suppose if one of those escape) then it should return #[none] instead. This function will need to be native, since it would be used in core control flow to defang unsets. And I have no idea what to call it, so I'm looking for suggestions. |
Example code |
; Rebol code equivalent func [value [any-type!]] [unless unset? :value [:value]] |
Assigned to | n/a | Fixed in | - | Last Update | 6-Mar-2014 05:43 |
---|
Comments | |
---|---|
(0003716)
BrianH 22-Mar-2013 06:14 |
Fork suggested DEVOID for this in SO chat, which is metaphorically accurate and less whimsical than DEFANG. The downside is that it makes reference to the "void" type in C-like languages that serves a similar purpose to returning unset in Rebol, but Rebol isn't a C-like language.
Another option would be TO-VALUE since it converts non-values like #[unset!] to values like #[none]. It's a little long, but it fits in with the other TO-* functions, though without the copying that those do. I don't want to call it VALUE because that is a common variable name. Other suggestions would be welcome. |
(0003719)
Ladislav 22-Mar-2013 12:15 |
I prefer the TO-VALUE alternative. |
(0003720)
abolka 22-Mar-2013 13:22 |
I prefer TO-VALUE as well. |
(0004321)
BrianH 6-Mar-2014 05:43 |
Implemented as TO-VALUE in https://github.com/rebol/rebol/pull/205 |
Date | User | Field | Action | Change |
---|---|---|---|---|
6-Mar-2014 05:43 | BrianH | Comment : 0004321 | Added | - |
6-Mar-2014 05:42 | BrianH | Summary | Modified | Function to convert unset to none => TO-VALUE function to convert unset to none |
6-Mar-2014 05:42 | BrianH | Status | Modified | reviewed => pending |
17-Feb-2014 22:00 | BrianH | Status | Modified | submitted => reviewed |
22-Mar-2013 13:22 | abolka | Comment : 0003720 | Added | - |
22-Mar-2013 12:15 | Ladislav | Comment : 0003719 | Added | - |
22-Mar-2013 12:13 | Ladislav | Comment : 0003718 | Removed | - |
22-Mar-2013 12:11 | Ladislav | Comment : 0003718 | Added | - |
22-Mar-2013 06:19 | BrianH | Comment : 0003716 | Modified | - |
22-Mar-2013 06:19 | BrianH | Comment : 0003716 | Modified | - |
22-Mar-2013 06:14 | BrianH | Comment : 0003716 | Added | - |
22-Mar-2013 04:40 | BrianH | Description | Modified | - |
22-Mar-2013 04:40 | BrianH | Code | Modified | - |
22-Mar-2013 04:36 | BrianH | Ticket | Added | - |