On 12 Apr, Manuel Kessler wrote:
> On Thu, 12 Apr 2001, Andrew Reilly wrote:
>
>> On 11 Apr, Jim Edwards wrote:
>> > The export keyword should do this, but I don't know of
>>
>> Really? I'm very surprised that anyone even thinks that this is
>> possible.
>
> It is actually quite simple (at least conceptually): when compiling the
> template source, don't generate code, but put some intermediate form
> (e.g. the parse tree or something equivalent, possibly even the plain
> (tokenized) source) and the necessary context (about
> dependent/nondepedendent) names into the library. Then make the linker
> smart enough to make (at instantiation time) a callback to the compiler
> with the now known values for the template parameters, so that actual code
> can be generated. Instantiation may trigger other template instantiations
> until this recursion ends (otherwise the source is buggy). The library
> then works as some kind of template repository.
That's essentially the structure that I described in the piece of
my message that was clipped.
I still don't see why that is thought to be more useful than
putting the template definitions in header files. The effect is
the same. The code still has to be compiled before it can run.
Can ocaml do generics? I remember reading that it has a "partial
compilation" model for distributing not-quite-compiled code that
was somehow related to the compiler's parse tree. Maybe it's not
such a dumb idea...
-- Andrew--------------------- Object Oriented Numerics List -------------------------- * To subscribe/unsubscribe: use the handy web form at http://oonumerics.org/oon/ * If this doesn't work, please send a note to owner-oon-list@oonumerics.org
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:15 EST