develooper Front page | perl.perl6.language | Postings from August 2006

Type annotation on expressions

Thread Next
From:
Yuval Kogman
Date:
August 8, 2006 02:32
Subject:
Type annotation on expressions
Message ID:
20060808093136.GS24279@woobling.org
Is there any way to type annotate a single expression, without using
a temporary variable?

	my Moose $x = $y; # definitely a Moose now, may have  been coerced
	foo( $x );# foo() doesn't necessarily say it wants Moose

Is it possible to say this one expression? Haskell's syntax is shiny
but everybody wants the colon:

	foo( ( $x :: Moose ) );

If we do find something (please ignore the fact that :: is probably
not going to be the syntax), are these two the same?

	my $x = ( $y :: Moose );

	my Moose $x = $y;

-- 
  Yuval Kogman <nothingmuch@woobling.org>
http://nothingmuch.woobling.org  0xEBD27418


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