|embedding java code in auto generated code email@example.com (2001-02-01)|
|Re: embedding java code in auto generated code firstname.lastname@example.org (Eric Eide) (2001-02-04)|
|Re: embedding java code in auto generated code email@example.com (Joachim Durchholz) (2001-02-25)|
|From:||"Joachim Durchholz" <firstname.lastname@example.org>|
|Date:||25 Feb 2001 11:00:41 -0500|
|Posted-Date:||25 Feb 2001 11:00:41 EST|
Hmm... I hope this isn't too late (I'm still working on my backlog), but
anyway, here goes:
Ronald Blaschke <email@example.com> wrote:
> I would like to embed some java code blocks in automatically generated
The simple answer is Don't Do This.
You can achieve the same effect by making an abstract class with
"execute" as its sole abstract member, then derive from it.
There's a general problem with embedded code of this type: "execute"
will access any available data in a rather uncontrolled way, so you'll
have trouble if you ever want to modify the frameword surrounding
"execute". This problem will be there regardless of whether you use a
code generator or inheritance. Well, in Java there's a slight
advantage for inheritance: you can make members private so they aren't
accessible to "execute", so at least these remain open to framework
evolution. The problem is to decide what should become private, but
that's a general problem of OO...
However, there is one massive advantage to the inheritance approach:
it will spare you parser writing, parse and run-time error handling,
documentation of your tool, and keeping up with the changes in the
Return to the
Search the comp.compilers archives again.