I've done a little more experimenting with this problem and have narrowed it down a bit. It seems like there might be an over-optimization, as the following code works properly:
void myfunc() { function f = Cocoa.NSOpenPanel.openPanel; object o = f(); }
whereas this code causes the openPanel function to be called during compile time, rather than when the function myfunc is actually called:
void myfunc() { object o = Cocoa.NSOpenPanel.openPanel(); }
Similarly, the backtrace at the time of the incorrect call to openPanel() looks something like this (non-relevant frames removed):
#9 0x0001aeb0 in apply_low_safe_and_stupid (o=0x18144a8, offset=71) at /Users/hww3/Pike/7.7/src/interpret.c:2384 #10 0x00105390 in eval_low (n=0x1892f30, print_error=0) at /Users/hww3/Pike/7.7/src/las.c:5692 #11 0x0010aad0 in eval (n=0x7f5018) at /Users/hww3/Pike/7.7/src/las.c:5765 #12 0x0011026c in optimize (n=0x1892f00) at /Users/hww3/Pike/7.7/src/las.c:5494 #13 0x00110980 in dooptcode (name=0x1892f30, n=0x1892f00, type=0x47, modifiers=7361024) at /Users/hww3/Pike/7.7/src/las.c:5926 #14 0x00005ac8 in yyparse () at language.yacc:948 #15 0x000c6fbc in run_pass2 (c=0x1892f00) at /Users/hww3/Pike/7.7/src/program.c:6913 #16 0x000c7418 in compile (aprog=0x418, ahandler=0x219ca0, amajor=71, aminor=-1073751884, atarget=0x4, aplaceholder=0xbfffd8a8) at /Users/hww3/Pike/7.7/src/program.c:7127
I'm glad to try to work on solving this problem, but it's a little bit further down in the core than I'm accustomed, so I'll gladly take advice on this. So, anyone have any? :)
Bill