Joe Gottman writes:
> How do you declare a function that doesn't return anything? For instance, a
> C++ swap function might be declared
> template <class X>
> void swap(X &x, X &y);
>
> It would be nice to declare the corresponding Perl6 function as
> sub swap ($x is rw, $y is rw) returns nothing {...}
> or something similar.
Use the Void pseudo-type:
sub swap ($x is rw, $y is rw) returns Void {...}
Or if you're in a more C-ish mood:
our Void sub swap ($x is rw, $y is rw) {...}
> This would be an absolute necessity if you wanted to emulate C++, Java, or
> any other strongly typed language.
>
> Also, it could be useful for causing a compile-time error if someone types
> something like
> $z = swap($x, $y);
>
> Joe Gottman
>
>
>