On Sat, 2005-04-30 at 22:24 +0800, Autrijus Tang wrote:
> On Sat, Apr 30, 2005 at 09:13:26AM -0500, Abhijit Mahabal wrote:
> > I do not see how any auto-threading occurs in that code. It is completely 
> > innocuous in that sense, and I don't think that is what horrified David. 
> > What was troublesome was, I think:
> >     my Str|Int $x;
> >     $x.foo(); # runs two methods and returns a junction
> 
> That would be absolutely horrible.

Then tell me what $!.can("chars") returns, assuming that $! is
implemented as an "any" junction of Int and Str values? My take would be
that it returns false|true, which is true in a boolean context, but feel
free to talk me out of it.

Str|Int is simply the type of "Yes"|1, isn't it? That would certainly
make signature matching on different kinds of junctive types trivial.

> > I would like to be able to read the above code to mean:
> >     type X ::= Scalar where Str|Int;
> >     my X $x;  # $x = non int/non string now a runtime error
> >     $x.foo(); # no different from if you had just said my $x
> 
> This is my current understanding in the implementation.

That's not a junction, and thus should not use junction syntax.

I'm not opposed to having such a construct, but re-using junction syntax
is going to cause massive headaches for anyone trying to learn the
language.

Also, what is:

        $x = ::("Int") | ::("Str")
        my ::($x) $y;

at which stages of the execution of that code? Are you saying that $x
does not contain a junction, or that a junction used as a type does not
create a junction value?

If the latter, then what is the type of "Yes"|1?


Reply via email to