At 12:33 AM 10/24/00 +0100, Simon Cozens wrote:
>On Mon, Oct 23, 2000 at 03:40:26PM -0700, Peter Scott wrote:
> > >Don't forget that those BEGIN blocks are *supposed* to be instructions
> > >to the compiler.
> >
> > Er, but a lot of people seem to use them for other things :-)
>
>Then they're going to have a shock. This isn't Perl 5 any more, Toto.
Yeah, but we haven't changed things *that* much. At least not without an
edict from Larry.
Besides, instructions to the compiler are executable code pretty much by
definition, so I don't see what sort of limits we could place on them.
They'll have to allow general code execution, since many of those compiler
hints are conditional module loading.
Generally, though, I'm not inclined to hand anything off to the optimizer
until after all the BEGIN blocks have been run. Sure it may mean a
semi-populated symbol table and various independent scopes hanging around
for subs, but we're going to need to handle that anyway, so I don't see it
as a big deal.
> > What about introducing a pragma which either (a) promises not to use such
> > things, or (b) throws an exception if the program does use such
> constructs,
> > and say "if you want your programs to be compilable (or compile to
> > something a heck of a lot lighter), say 'use strict "compilation"' or
> > whatever"?
>
>Why bother? We can tell if such a thing is going to be introduced from the op
>tree. It only matters when we want to compile things, and I'm guessing that's
>going to be the minority of cases. When Joe Random writes his one-liner, I
>don't want to interfere with him.
Neither do I, but I think you'll find a lot of those programs will want to
be fed through the optimizer as best as possible. Sure some might be only a
dozen lines or so, but I'd be happy to pay 10 seconds to shave off one msec
an iteration of some loops. Optionally (and off by default) of course, but
don't dismiss heavy optimizations on tiny programs. Granted I may be in the
minority, running one-liners over 100M+ files, but a lot of perl code's
bigger than that.
A lot of the tiny programs aren't all that tiny, either. Ten lines isn't
much unless one of them's "use CGI;" or "use Net::FTP". And there are huge
gobs of those.
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk