D
David N. Welton
Hi,
We've hit something of a stumbling block with Hecl
(http://www.hecl.org), and it's proving tricky. J2ME doesn't necessarily
have floating point. And since we'd like Hecl to run in as many places
as possible, this necessitates that the J2ME and J2SE versions contain
different code, but Java doesn't make this easy, because there are no
macros or other ways of conditionally compiling code.
The solution we've adapted so far is problematic because it's not very
fine grained: we have two separate directories, one for 'core' Hecl
(sans floats) and another that contains the exact same classes, but with
floating point. For instance:
http://cvs.sourceforge.net/viewcvs.py/hecl/hecl/core/org/hecl/BasicMathCmd.java?rev=1.7&view=markup
(no floating point)
http://cvs.sourceforge.net/viewcvs.py/hecl/hecl/float/org/hecl/BasicMathCmd.java?rev=1.6&view=markup
(floating point)
As you can imagine, this means that code is replicated in two places,
and each change has to be done twice, carefully, keeping track of the
actual differences between the two files. This can only get worse as the
code grows.
I've seen some hacky ways of doing macros and things like that, but they
don't look very satisfying. I'm too much of a Java novice to think of
anything better than what we've got, though.
Any thoughts from the experts?
Thankyou,
--
David N. Welton
- http://www.dedasys.com/davidw/
Linux, Open Source Consulting
- http://www.dedasys.com/
We've hit something of a stumbling block with Hecl
(http://www.hecl.org), and it's proving tricky. J2ME doesn't necessarily
have floating point. And since we'd like Hecl to run in as many places
as possible, this necessitates that the J2ME and J2SE versions contain
different code, but Java doesn't make this easy, because there are no
macros or other ways of conditionally compiling code.
The solution we've adapted so far is problematic because it's not very
fine grained: we have two separate directories, one for 'core' Hecl
(sans floats) and another that contains the exact same classes, but with
floating point. For instance:
http://cvs.sourceforge.net/viewcvs.py/hecl/hecl/core/org/hecl/BasicMathCmd.java?rev=1.7&view=markup
(no floating point)
http://cvs.sourceforge.net/viewcvs.py/hecl/hecl/float/org/hecl/BasicMathCmd.java?rev=1.6&view=markup
(floating point)
As you can imagine, this means that code is replicated in two places,
and each change has to be done twice, carefully, keeping track of the
actual differences between the two files. This can only get worse as the
code grows.
I've seen some hacky ways of doing macros and things like that, but they
don't look very satisfying. I'm too much of a Java novice to think of
anything better than what we've got, though.
Any thoughts from the experts?
Thankyou,
--
David N. Welton
- http://www.dedasys.com/davidw/
Linux, Open Source Consulting
- http://www.dedasys.com/