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

Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?

Thread Previous | Thread Next
March 31, 2005 00:33
Re: Parameter and trait questions - just how 'only' _is_ 'read-only'?
Message ID:
Thomas Sandlaß wrote:
>   Int|Str <: Str && Str <: Int|Str && Int|Str <: Int && Int <: Int|Str
> holds.

Uhh, I hardly believe that it was me writing that last night!
Int|Str is of course a proper supertype of Int and Str respectively.
So we really have: Str <: Str|Int && Int <: Str|Int, which warps us
back to the co-/contravar problem of polymorphic rw containers.
And that doesn't help very much in achieving high flexibility under
the benevolence of strong typing.

> Given an even more complex Any type that encompasses the general
> purpose types of Perl6---namely Str, Int, Num, Bool and Refs thereof---
> the lazy Perl6 programmer gets what Perl5 did all the time. This is
> what is called "Render the Illusion of Simplicity".

The solution is to make the juntive supertype on the polymorphic array
itself, which actually is much clearer:

class Array does Array of Str | Array of Int | ...
{ ... }

I'm not saying that this is easy to implement, but I'd appreciate
if it were part of Perl6 for a comprehensive set of types. I would
also expect some work on the side of new classes/types to participate
in this rw Array scheme.
TSa (Thomas Sandlaß)

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About