if I understand correctly, the :immediate pragma makes the sub which has
this pragma run immediately after parsing (well, at least before running
the program)
Suppose I have this code:
.sub loadstuff :immediate
# load stuff
.end
.sub main
dostuff( )
end
.end
Then, running this code will start running the loadstuff( ) again
(because main doesn't have the :main pragma, and loadstuff() is at the
top of the file).
My concern is, is this the desired effect? Shouldn't the :immediate subs
only be run once? So, in effect shouldn't they be skipped (if they're at
the top of the file, where execution starts when :main is missing) when
running the program?
regards,
klaas-jan
> Then, running this code will start running the loadstuff( ) again
> (because main doesn't have the :main pragma, and loadstuff() is at the
> top of the file).
> My concern is, is this the desired effect?
I dunno, what the desired effect is. But it works now as documented.
There are 2 easy code changes to get your 'desired' effect:
1) label one sub with :main
2) don't emit :immediate as the first sub
leo
I'm a fan of explicitness and orthogonality -- I don't see that
":immediate" should silently imply "and don't use this sub as :main".
If a sub other than the first one listed is main, mark it as ":main"
and be done with it.
Pm