> i think you are mistaken. TIL means to me Threaded In Line code. the
> term threaded code had a meaning way before execution threads. it is a
> very simple way to generate executable machine code and some compilers
> used it. all the work was done in subroutines (as in perl) but the
> generated code is real machine instructions which are mostly just
> argument setup, sub calls and return handling. so you can see the flow
> 'threading' in and out of each sub.
>
What is the impact of TIL on what is possible on the language side? I'm
particularly thinking of how loops are optimised in Perl Data Language
(http://pdl.perl.org). PDL uses a mini-language called 'PP', which is
compiled down to optimised loops in C. Not the most convenient or perlish
approach, but about the best you can do with perl 5.
The PDL team are now examining how to incorporate these kinds of features
into perl 6. I'm also interested in seeing how to implement things like
(from RFC 82)
<quote>
@b = (1,2,3);
@c = (2,4,6);
@d = (-2,-4,-6);
$sum = reduce ^_+^_, @b * @c + @d;
should be evaluated as if it read:
$sum = 0;
$sum += $b[$_] * $c[$_] + $d[_] for (0..$#b-1));
That is, no temporary list is created, and only one loop is required.
</quote>
These kinds of optimised loops require quite a bit of smarts from the
compiler, and probably some run-time optimisation as well. Is this likely to
be achievable in Perl 6? Is this the kind of thing that TIL can simplify?