This was actually discussed a while back when the clumsiness of the current main prototype was on topic. Instead of doing smart stuff with the main function call it was suggested that create was extended to get the information it could not retrieve in other ways (env can be retrieved from getenv and argc is of course sizeof(argv)). It can even be said that having a main function at all is a convenience detail, since no one has been trying to hide the fact that all programs are turned into objects, and thus have a create call.
/ Martin Nilsson (har bott i google)
Previous text:
2003-04-16 15:00: Subject: Pike Cookbook
void create() { write("Hello World!\n"); exit(0); }
Somehow I don't like that version too much. It smells like "violating the rules by exploiting an implementation detail". But then, Pike is (to date) defined by its implementation, so "the rules" means as much as anything the implementation will swallow (unfortunately so?).
More to the point, my choice would have been to have the master check for the presence of main() in a script, before cloning an object from the compiled program, rather than passing argv to create()... but maybe I'm just nitpicking...
/rjb
/ rjb