Luke Palmer wrote [reply to my Void type suggestion] > It could also behave as our bool type. Something that you can attach > properties to but doesn't need a value seems that it could be useful > every once in a while. > > Just... what does a void literal look like? Perhaps just the word > C<void>? > > my void $false_var = void but false; > > I'm just speculating. But I do see a use for it.
I see the Void type as being truely void: foo($bar); Void $baz = foo($bar); should be synonymous. But the Void type can crop up in a number of places. The most obvious is as the return type of a function. But it could also be useful in any place where a value might be unwittingly preserved. Its greatest uses are probably for the C<want> builtin (or whatever the souped-up C<wantarray> is); and for generated code (whether on-the-fly evaled; or the output of a real code generator). It could also be used as a a hack to create non-existant attributes on a class. I would hope that, if you did attach properties to a void value, then they would go straight to the same bit-bucket as the value itself. (compile-time C<is> properties are a different matter). Dave.