Question: as someone who has never used either of the engines that you
reference, do they actually perform impl language -> JS conversions?
GWT does that for sure. Webtoolkit has a different approach, something
along stateless slots. It kinda records what the serverside does and
rebuilds that behavior in javascript.
Sounds like an absolutely enormous job. Assuming you had a working d
parser and semantic analyzer (and in-depth understanding of its inner
workings), it could probably be done in less than six months (as long as
the language it was written in doesn't *cough* suck).
Do you think I need such a deep understanding? Couldn't I just choose to
support a certain subset of D and do only more simple conversation without
in-depth analysis and all this?
--Marenz
Am 22.05.2010, 21:15 Uhr, schrieb Ellery Newcomer
<[email protected]>:
On 05/22/2010 01:19 PM, Mathias Laurenz Baumann wrote:
Greetings,
I want to write a web-library/framework, similar to [1]Webtoolkit or
[2]GWT.
For that I need to transform a sub portion of D code to javascript.
Additionally, I dislike changing the toolchain, which means it has all
to happen at the
compilation time.
I want to know what you think about the following possibilities and
whether you know better ones.
a)
Write a compile-time template based parser for D to JS code and parse
the .d files and transform them
b)
write a initialization-time parser for D to JS code, to access the D
code, each to-be-converted file
needs to have its own code as string, like char[] src = __FILE__;
Currently, I believe there is only one semantic analyzer for D on the
planet: the dmd front end. Use it as is, use Ary's port, use Denis'
port. (a) is not an option in this case, unless you want to spend most
of forever porting the dmd front end to compile time evaluatable D.
And you will have to support the entire D language if by toolchain you
mean you want access to the routines in phobos or tango or whatever. (If
not, then I don't see the point of converting your D code to JS
mechanically.) And then you're going to have to deal with things like
extern(C), which are all over the place in both libraries, which I
suspect is nontrivial or not possible.
So unless I've misunderstood something, I don't think avoiding JS is
really worth all the effort. Sorry for being a pessimist.