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

Type annotation on expressions

Thread Next
Yuval Kogman
August 8, 2006 02:32
Type annotation on expressions
Message ID:
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 <>  0xEBD27418

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