>>> Procedure iso_fun( function f( x: real): real);>>> begin >>> StoredF:=F; >>> end; >> >> This assignment is invalid, it's the same as trying to assign a method >> to a >> regular procedural variable. > > This is exactly my point: how does the compiler distinguish the two in > this case ?
Possible soultions: They have different datatypes, or a flag is set in the type definition. > I don't see how, unless you add an extra parameter for the 'iso' way of > doing things. > > So, basically, to be able to use a local procedure as a callback, > - You must declare a function with the ISO way to specify a callback. > - This function is not usable with a global callback function. > -> So if you would want to use such a function for both normal and local > procedures, you would have to implement it twice ! > > If this is indeed the case, then it is totally ridiculous in my opinion > to implement such a "feature", because if you must make special amends > _anyway_, then you can just as well do it with global functions, without > the local variants. > > I would only see the use of being able to pass a local function as a > callback > if the called function can be used for both local and global callback > procedures. It can. When a global proc is passed, the static link is set to nil. > I question the usefullness of this whole "feature". When using a call back, you dont need to pass data to it as global variables, making code cleaner. Olle _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel