f'up to p6l, because the ticket doesn't need the rest of the discussion.

On 03/19/2014 10:21 PM, Darren Duncan wrote:
> On 2014-03-19, 1:20 AM, Moritz Lenz wrote:
>> On 03/19/2014 12:45 AM, Darren Duncan wrote:
>>> Damian, Moritz, etc,
>>>
>>> It seems to me that the basic problem here is that the vertical bar |
>>> has 2 different meanings (outside rules) depending on context.
>>>
>>> When used with type names it produces a union type, while with normal
>>> values such as integer literals it produces a junction value.
>>
>> No. It's always a Junction. Perl 6 has no union types.
> 
> Really?  All this time I thought in Perl 6 you could write say:
> 
>    my Int|Str $foo;

You were wrong.

The only way to achieve something comparble is

subset IntStr of Any where Int|Str

but for example for multi dispatch, it matters that not a nominal type
matched, but rather a constraint, so that's a not a great replacement.

> Or otherwise say Int|Str anywhere a type name could go, and then this is 
> saying 
> you accept anything that is a Int or a Str but nothing else there.
> 
> Was that never true or was it replaced by something while I wasn't looking?

There was something like that in the specs, but no concept whatsoever of
how that might work. You can't just slap on union types onto an existing
type system, and have it magically work out. In languages like Haskell
where they work fine, they are right at the core of the language.

So the feature was removed years ago, because it's not really implementable.

Cheers,
Moritz

Reply via email to