Leopold Toetsch wrote: > Jerome Quelin <[EMAIL PROTECTED]> wrote: > > - will objects introduce a speed overhead? > For sure, but not a big one. You can AFAIK obtain an integer index > for an attribute or method so its basically an array lookup.
Nice. So maybe I'll go for an object... > > - if I implement the Lahey space module as a regular module, how > > can I declare file-scoped vars that will be accessible by the > > subroutines of the file and only them? Since imcc parses > > compilation units first, I don't see how to do this... Maybe with > > the ".namespace" keyword? > Just put a ".local" or ".sym" declaration outside/in front of your > subs. This declares a file-scoped variable. It does not seem to be file-scoped: $ cat main.imc .sub __START__ call _main .end .include "lahey_space.imc" .sub _main call _lhs_init print "main.imc: " print width print "\n" end .end $ cat lahey_space.imc .local int width .sub _lhs_init width = 42 print "lahey_space.imc: " print width print "\n" ret .end $ imcc main.imc lahey_space.imc: 42 main.imc: 42 $ It looks like a global variable to me. > > - the global does not seem to be available: > > $ cat foo.imc > > sub _main > > .local int width > > width = 0 > > global "lhs_width" = width > The *global opcodes are PMC variables only. > > Will the feature be implemented soon? > As the global stash is a PerlHash, it could be done. OTOH all the > lexical opcodes are PMC-only too and these can only store PMCs in > their array slot. Okay. > > - when including a file with .include, the line numbering > > continues to increase without being zeroed, and it's quite > > difficult to track errors because of this behavior > This needs work - Or its a bug, if line numbers are messed up by > including a file. Not messed, but it would be nice to have the real file and line number of the error. Jerome -- [EMAIL PROTECTED]