Skip to content

Commit ccac327

Browse files
committed
Add in a void function
For aesthetic reasons, some people might prefer to write `return void` instead of `return ()`. It's not possible to fetch a void value from a word, so that has to be a function...which makes it less efficient. It also could be confusing, because unlike `get 'blank` or `get 'bar` or `get 'true` the value that comes back would be a function. But rather than be prescriptive that people have to say () in the source if they don't like the way that looks, this standardizes the option so everyone doesn't have to make this function themselves.
1 parent 2d995cf commit ccac327

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mezz/base-defs.r

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ ok?: func [
151151
blank: _
152152
bar: '|
153153

154+
; void is a little bit dodgy because it's not an alias for a value (e.g. you
155+
; GET it and you'll have a function). But it cannot be a value retrieved via
156+
; a word because void isn't a value. Still, having it as a word might
157+
; be considered by some to be more literate than `()`.
158+
159+
void: does []
160+
154161
; Experimental shorthand for ANY-VALUE? test (will also be VALUE?)
155162
;
156163
?: :any-value?

0 commit comments

Comments
 (0)