On Wednesday 10 July 2002 02:39 pm, Melvin Smith wrote:
>
> Since Perl vars type-morph themselves, Perl will use PMC types everywhere
> that there is an exposed interface. Internally you could use an I/S/N
> register.
>
> I see no reason why
>
> foreach my $i (@nums) {
>   ...
> }
>
> should not use an Ix reg for $i, but maybe $i isn't an int at all, or @nums
> is actually a mixed list.

I thought that was the whole point of typing in Perl 6.

my int @nums = (1, "2", 3.1);   # (1,2,3) assuming C<my int @foo> 'works'

for @nums -> $i {}      # $i is a PMC, still
for @nums -> int $i {}  # $i is in an Ix register now
for @nums {}            # will $_ be smart enough to 'int' itself? I hope so

Yes, people will have to think about optimizing their code. It's not great, 
but it's not that onerous. It might be nice if the current topic would type 
itself based on its initializer, when obvious.

Ashley Winters

Reply via email to