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

Re: Type variables vs type literals

Thread Previous
From:
Larry Wall
Date:
July 1, 2005 12:38
Subject:
Re: Type variables vs type literals
Message ID:
20050701193819.GA580@wall.org
On Fri, Jul 01, 2005 at 11:51:55AM -0700, Larry Wall wrote:
: So either we need a different sigil for type variables, or a syntax
: for explitly binding and declaring an autovivified type.  (Which,
: interestingly, could also be used in rvalue context.)

I neglected to provide an example of this, but it'd be something like

    $x = (my T) $y;

to declare that T is whatever type $y happens to be when evaluated.

It would have to be a special form, though, since it needs to expect
a term after it rather than an operator.  And it would require the
absence of anything following T, since (my T $x) means something
entirely different, and in fact requires an operator to follow.
I don't see a better approach offhand, unless it's [my T], which
would have to be just a special, and risks visual confusion with
lists and reduction operators.  So I'm still thinking (T)/(my T)
is the better approach.  But it could use more collective mulling.

Larry

Thread Previous


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