develooper Front page | perl.perl6.language | Postings from February 2005

Re: Fun with junctions (was Sets vs Junctions)

Thread Previous | Thread Next
From:
Damian Conway
Date:
February 12, 2005 14:09
Subject:
Re: Fun with junctions (was Sets vs Junctions)
Message ID:
420E7E82.5060000@conway.org
Rod Adams wrote:
> I also find the following incredibly disturbing:
> 
>  >perl6 -e "$x = 'cat'|'dog'; say $x;"
> dog
> cat

That would be disturbing if that's what happened.
C<say @what> is just a shorthand for C<print @what, "\n">.
So saying a junction is the same as printing it, which is a run-time error.


> Can a junction hold values of completely different types, or just 
> different values of the same type?

Junctions are values. They don't "hold" anything.
Can a junction have values of different types? Yes.


> If evaluation of one value of a junction causes an error, is $! now a 
> junction as well?

See Larry's response. My response it that, by default, if:

	foo(2)

and

	foo(3)

each throw an exception, then:

	foo(1|2|3);

throws an (single, non-junctive) exception. Which exception gets thrown is 
indeterminate, since the ordering of a junction, and hence of the 
autothreading of a junction, is indeterminate.

Damian

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About