On Jan 20, 2006, at 20:57, Chip Salzenberg wrote:
On Fri, Jan 13, 2006 at 05:51:53PM +0100, Leopold Toetsch wrote:
This could be fixed by special-casing the initial call to ':main',
and then turn on param count checks if wanted.
I think you'll need to invert that, given that code can be executed
before :main, e.g. :immediate. Default the errors on, and if
necessary[*], temporarily disable them for the :main call.
Of course.
[*] I actually don't have a problem requiring all :main subs to have
explicit .param argv. But I'd also be OK with a code generator
hack that inserts an automatic .param __argv in :main if the user
doesn't say .param himself. Then the errors can be left on always.
Well, the problem isn't PIR code at all. C<.sub main :main> can
translate to everything including an extra line C<.param pmc __argv
:optional> if no params are given.
Troubles are coming from PASM code, which can start with an arbitrary
opcode. While a dummy Sub PMC is already provided, it's not trivial to
insert an empty get_params opcode.
Therefore the simpler way is to special-case the call to :main.
leo