robin.davies at quest.com
Tue Nov 1 15:31:06 EST 2005
There were remnants and vestiges of an "auto-include" feature in Chuck sources last time I looked. These looked fairly promising. I'm not sure what the original intent was -- it didn't seem to be terribly functional in the last set of sources I looked at, but the general intention seemed like a good idea.
As I read it, the intention was to look for a matching source file for undefined classes and load the matching source file on demand. The complication, presumably, is that the class implementations have to be loaded in multiple steps: parse all declarations of auto-included files first, and then bind references in a separate pass, in order to avoid problems with circular references. The code for the multi-step binding seems to be mostly there too -- more there, than the auto-include flag, anyway.
The basic idea seemed sound, and is somewhat better than providing a lexical include facility.
> -----Original Message-----
> From: chuck-users-bounces at lists.cs.princeton.edu [mailto:chuck-users-
> bounces at lists.cs.princeton.edu] On Behalf Of Rasmus Kaj
> Sent: Tuesday, November 01, 2005 2:16 PM
> To: ChucK Users Mailing List
> Subject: Re: [chuck-users] include
> >>>>> "PD" == Philip Davidson <philipd at CS.Princeton.EDU> writes:
> PD> yes, but it's in development / testing phases.
> Ah, I should take a look at that, then ... Is it a "simple lexical"
> include (like with the c preprocessor), or is it in a higher level,
> (what I'd like to call require/provide, like in elisp), so that the
> included code only needs to be compiled once?
> Basically, I'd like "require foo" to check (in a hash table) if foo
> allready is provided, and in that case just return. If foo isn't
> provided, it could search the load path for "foo.ck", and compile that
> if found.
> This would be very simple given a global namespace for functions and
> classes (so that the classes in foo is available for all shreds when
> foo is required in one). Otherwise require would also have to include
> the foo namespace into the current namespace.
> Rasmus Kaj --+-- rasmus at kaj.se --+-- http://www.stacken.kth.se/~kaj/
> Det är alldeles för mycket sport inom idrotten
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
More information about the chuck-users