Jeff Clites <[EMAIL PROTECTED]> writes:

> On Apr 23, 2004, at 11:04 AM, Simon Cozens wrote:
>
>> [EMAIL PROTECTED] (Jeff Clites) writes:
>>> So what does "$foo = 12" in that context actually mean in Perl6?
>>
>> Another interesting question is "in Perl 6, are variables typed,
>> values typed,
>> or a little of both?"
>>
>> It seems that Parrot has been working primarily on the assumption that
>> it's
>> values that are typed, and punting variable typing to the IMCC code
>> generation
>> layer.
>
> That's my worry--whether we have a problem. (No problem with typed
> values, of course.) If variables are typed, _and_ that typing is
> lexically scoped, then I think that we don't have a problem, and it can
> be handled at the compilation level, by inserting the appropriate type
> checks right before each assignment.

Which begs the question of what happens when you do, something like:

    my Dog $spot;
    some_func(\$spot);

    ...
    
    sub some_func($thing) {
        $$thing = Cat.new();
    }

It could be argued that our current PerlUndef is all very well, but it
confuses the roles of container and value. Maybe the declaration
above should translate to something like:

    new $P0, 'PerlScalar';
    $P0.set_type('Dog');
    store_lex '$spot', -1, $P0
 

Reply via email to