On C/C++ undefined behaviours

Nick Sabalausky a at a.a
Fri Aug 20 23:28:30 PDT 2010


"Walter Bright" <newshound2 at digitalmars.com> wrote in message 
news:i4nqis$19fd$1 at digitalmars.com...
> Nick Sabalausky wrote:
>
>> - Distributing in source form makes certain things possible that wouldn't 
>> otherwise be, like virtual template functions (in theory, even if not in 
>> actual D practice).
>
> Yup again, Java can't do compile time polymorphism!
>

I'm not sure whether we're talking about the same thing. I mean something 
like this:

module A;
class Base {
  void foo(T)(T x) { }
}

module B;
class Derived : Base {
  void override foo(T)(T x) { }
}

I know D doesn't currently allow that. But my understanding is that if 
module A is available in source form, then there's no technical issue 
preventing it. So if a dev house wants to keep their source private, then 
they can't expose any API like that even if their language did normally 
allow such a thing. Therefore, keeping source private limits what can be 
done.

Of course, even just exposing any old template requires at least some code 
to be exposed (or easily-reconstructable).

> BTW, I realized around 10 years ago that what you can do is lex D source 
> and use the token stream as your "intermediate code". It should work 
> great, be compact, and fast.

Would that be useful in any significant way? Wouldn't re-lexing be very 
quick too? And in my limited experience, lexing seems to be a little easer 
than parsing, too.




More information about the Digitalmars-d mailing list