On Fri, Oct 07, 2005 at 12:42:01 +0200, Juerd wrote: > For my Int $c = $float, though, I'd want coercion. > > And I think it is wrong to have such a huge difference between literals > and values: if a variable coerces, a literal has to do so too.
How do you tell the compiler "this must never be a float, ever"?
There is a conflict between the usefulness of coercion and the
usefulness of staticness, and I think we need to be able to express
both.
Perhaps we need two ways to type annotate:
hard annotations - applies to assignment or binding lvalues, and
states that the type must be an accurate subtype - no coercion
is allowed at all.
soft annotations - applies to assignment or binding lvalues, and
specifies that the thing contained in it must always be of the
annotated type, after the assignment. That is - a value must be
coerced as a copy to enter this container if it's type doesn't
match.
--
() Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418 perl hacker &
/\ kung foo master: /me sushi-spin-kicks : neeyah!!!!!!!!!!!!!!!!!!!!
pgpT5DKCUCMHu.pgp
Description: PGP signature
