Is Dog|undef a legal type?

2004-04-19 Thread Abhijit A. Mahabal
If we have a method that returns Dog if it returns anything at all, can we say: method foo returns Dog|undef {...} In a similar vein, if the function reurns a dog or a refernce to an array , can we use Dog|Array? And is this legal: given ($obj){ when Dog: ... when Array: ...

Re: Is Dog|undef a legal type?

2004-04-19 Thread Larry Wall
On Mon, Apr 19, 2004 at 11:00:33AM -0500, Abhijit A. Mahabal wrote: : If we have a method that returns Dog if it returns anything at all, can we : say: : : method foo returns Dog|undef {...} Yes, but... You'd say that only if you wanted to allow a return type that can be simultaneously Dog and

Re: Is Dog|undef a legal type?

2004-04-19 Thread Juerd
Abhijit A. Mahabal skribis 2004-04-19 11:00 (-0500): when Dog: ... when Array: ... Shouldn't that be: when Dog { ... } when Array { ... } Or is there some .when that I have not yet heard of? Juerd

Re: Is Dog|undef a legal type?

2004-04-19 Thread Abhijit A. Mahabal
Abhijit A. Mahabal skribis 2004-04-19 11:00 (-0500): when Dog: ... when Array: ... Shouldn't that be: when Dog { ... } when Array { ... } Or is there some .when that I have not yet heard of? Guilty as charged. My Perl6 is getting rusty... --Abhijit

Re: Is Dog|undef a legal type?

2004-04-19 Thread Larry Wall
On Mon, Apr 19, 2004 at 07:01:34PM +0200, Juerd wrote: : Abhijit A. Mahabal skribis 2004-04-19 11:00 (-0500): : when Dog: ... : when Array: ... : : Shouldn't that be: : : when Dog { ... } : when Array { ... } Yes, that's how it should be written. : Or is there some .when that