From: John L. <le...@cs...> - 2006-07-05 01:43:27
|
John Lenz wrote: > Now, it would be pretty easy to add a %feature (see > http://www.swig.org/Doc1.3/Customization.html) to export both constants > and immutable variables as scheme values and not scheme functions. > > What I would do is in the generated .scm file, add code like > > (set! myconst (myconst)) > > or if -proxy is given > > (define myconst ((vector-ref swig-init-return 3))) > Ok, I just coded this up. I named it as %feature("constasvar") and you can apply that feature to any constant or variable, and it will export the set! code above in the generated .scm file. You can either enable it as a global option (or on the command line with -features constasvar), or apply it to individual constants, or all the other ways %features can be applied. I am about to commit it to CVS, but does anyone have a better name for the feature? Is there a similar feature in other languages, that we could use the same name? John |