> Thus, I would ask of the devs, has this functionality been considered?
Yes. A solution for this problem is needed for Mac Pascal compatability. > Is there some particular reason that anyone is opposed to implementing > it? Not really I guess. > Or is it just difficult to implement, and/or not considered useful? Useful, but a lot of work. > There is a part of me that wants to jump in and try to implement this in > the compiler, although I suspect I would be in well over my head. Well, my ideas about it were: - there must be a local directive that enables a procvar type declaration t to become a "full" procvar. (to switch between compatible and full). Maybe mac mode should turn this on by default. - The new "full" procvar type consists out of a framepointer and a procedure address. A two pointer record, like tmethod. - In case of a global procedure being assigned to the full procvar, the framepointer=nil. - In case of a local procedure being assigned to the full procvar, the framepointer is the parents framepointer. (the implict first argument) - Calling such localproc is of course only allowed from within the immediate parent of the local procedure, so that the frame exists. - When a procedure calls such a procedure, on asm level the code is roughly like this: if assigned(procvar.frameptr) then procvar.procaddress(procvar.frameptr,arg1,arg2,arg3..) else procvar.procaddress(arg1,arg2,arg3..) Of course this is just brainstorming. IIRC Jonas punched a few holes in it when I talked to him about it, but I can't remember what they were. Except a warning that the callnode code was complicated, due to the many ways a procedure/method can be called. (think directives, special rules for parameter order, hidden params, float params, small complex types etc) > Before I consider making such an attempt (or looking for someone to do > it) it'd be nice to get a feeling for whether such an extension would > be welcome. It's on the roadmap for the mac dialect: http://wiki.freepascal.org/Mode_MacPas (Search for "planned", it is the "nested procedure parameters") item) > I am hard-pressed to detect any drawback or conflict, although of course > that's largely because I have no idea how this stuff is actually > implemented. See above. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal