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

Type variables vs type literals

Thread Next
From:
Autrijus Tang
Date:
June 29, 2005 18:28
Subject:
Type variables vs type literals
Message ID:
20050630012510.GB22695@aut.dyndns.org
Currently, does this:

    sub foo (::T $x, ::T $y) { }

and this:

    sub foo (T $x, T $y) { }

Means the same thing, namely

   a) if the package T is defined in scope, use that as the
      type constraint for $x and $y

   b) otherwise, set ::T to be the most immediate common supertype
      of $x and $y.

Is this understanding correct?  I'd like to disambiguate the two cases
by making ::T in parameter list to always mean type variable (sense b),
and the bare T always mean type name (sense a)?

Thanks,
/Autrijus/

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