Oldes / Rebol-wishes

Repository for keeping Rebol related wishes out of issues
0 stars 0 forks source link

WISH: allow `none!` as an `unset`'s argument #28

Closed Oldes closed 3 years ago

Oldes commented 3 years ago

May be useful if one needs to unset a value in a context, where the value is not presented at all. So far it is like:

>> ctx: context [a: 1]
== make object! [
    a: 1
]
>> unset in ctx 'a
>> unset in ctx 'b ;<--- will cause an error, because there is no `b` in `ctx`
*** Script Error: unset does not allow none! for its word argument
Oldes commented 3 years ago

My motivation came by answering here https://stackoverflow.com/a/65343543/494472 I found that I must write in the unload-module function:

try [unset in system/contexts/user e/1]

to be able unload a module which has no exports into user's context. If unset accepts none, I could avoid the try call.