On 06/10/02 14:40 +1000, Ken Williams wrote:
>
> On Sunday, October 6, 2002, at 03:39 AM, Brian Ingerson wrote:
> > Hmm. I hadn't considered this use case. I think I would have to add a
> > directive for this. Something like this:
> >
> > use Inline C => WAIT =>
> > NAME => Foo =>
> > VERSION => '1.23';
> >
> > use Inline C => <<':-)';
> > ...
> > :-)
> >
> > use Inline C => <<':^D';
> > ...
> > :^D
> >
> > use Inline C => 'FINISH';
>
> I'd rather see something like this:
>
> use Inline C =>
> WAIT => 1,
> NAME => __PACKAGE__,
> VERSION => '1.23';
>
> Inline->add_code(C => <<':-)');
> ...
> :-)
>
> Inline->add_code(C => <<':^D');
> ...
> :^D
>
> Inline->finish('C'); # Maybe 'C' is optional
The problem I have with this is that code doesn't get processed
until run time. Whereas with the "use" statements, this happens at
compile time.
And this, of course, affects bareword processing, and further parsing,
to some degree.
Actually, this whole thing brings up a lot of issues along those lines.
In the module case, everything will obviously be precompiled, so which
'use' statement will invoke the Dynaloader->bootstrap? Probably the
last one. But a user might expect the bareword to be callable right
after the Inline statement. I wouldn't blame her. Maybe I'll need to do
a multipass parse, and jam the bindable C function names into the
symbol table even before the bootstrap. That gets really nasty, because
how in the heck do I cache that parse? Mark is a real Fowler. This is
nasty stuff.
Also, Mark, I can't overload the CONFIG keyword because it would be
ambiguous as to whether it was starting a multi block usage or not.
I think I'll simply replace the word WAIT with START, and go with my
original suggestion. START/FINISH is at least symetrical. And the
keywords go in the right place. They are surrogates for the source code.
The general form of an Inline call is:
use Inline <language>, <source-code>, [config key:value pairs];
The keywords DATA, FILES, START, FINISH are all source code surrogates.
CONFIG is an anomoly. In fact, I may just drop CONFIG in the rewrite. It
reeks of TMTOWTDI.
Cheers, Brian