Re: Comments on ORAC
- Posted by Pete Lomax <petelomax at blu?yonder.c?.uk> Nov 12, 2007
- 649 views
Mike wrote: > > Matt Lewis wrote: > > }}} <eucode> > > global function call_indirect_function( integer func, sequence args ) > > -- error handling here... > > end function > > </eucode> {{{ > This throws up a subtle gotcha: Since indirect calls of both kinds could be > treated as functions, what happens if a procedure is inadvertently used in > an expression? The code will work but be wrong. As above, I think it will crash pdq, in an elegant way if you want. > But since indirect calls will always be slower than direct ones, is there > really > any point to optimizing? If not, then, there is no point to analysing the code > either. I have no qualms about suspending the code I've just written - it's > a hack anyway. I assumed part of your plan involved (eg) arwen + orac, and the extra layer round all message handling routines would probably be quite noticeable. > If this mask were added to Euphoria, what (other than Orac) could take > advantage of it? I would feel uncomfortable if Euphoria were modified just > to suit Orac - particularly when I'm inclined to something else. While I have no real example, there is clearly something quite powerful with seamless calls. True, you could achieve much the same effect by storing routine_ids and and define_c_func results along with an explicit tag, and non-orac uses of this idea would need to hand-code and hand-call a version of call_indirect_function(). > IMO, an easier solution is simply to add a specifier to a variable/constant > declaration. I am going to do this shortly unless someone can convince me > otherwise with very persuasive arguments. The only remotely relevant existing examples I can thing of are the vHandler table in win32lib, and the HandlerRoutine sequence in arwen. Both those happen to be homogenous (all Eu functions), so a single specifier at the variable level would probably work. But equally I could imagine someone wanting to replace some-but-not-all of them with c routines in a dll... Regards, Pete