D to Javascript converter (a hacked up dmd)
Adam D. Ruppe
destructionator at gmail.com
Thu Mar 1 11:11:16 PST 2012
On Thursday, 1 March 2012 at 18:56:07 UTC, Alex Rønne Petersen
wrote:
> Valid argument. Maybe we can make the D -> JS converter help in
> some way here?
I don't know yet. assert() in your D code, while a far cry
from a real debugger, does have the decency to give file
and line number in your browser error log, like so:
Error: uncaught exception: tests.d:9 [object.AssertError]
Assertion failure
in firefox, but it works in IE and I assume the others too.
Debugging in javascript is sure to be painful due to two
big facts though: 1) the line/file won't match up, and
2) the function and variable names are mangled, which gets
RIDICULOUSLY long in places, and very difficult to read.
For debugging, I might just put comments in the source
code.
/* file.d:30 */ var some_long_horrible_mangled_name = 20;
so at least you'd have a hope of reading it, by matching
it back up to your original source. This would be fairly
easy to implement and is better than nothing.
But, I don't know yet. For what I've done so far, a combination
of asserts and manually picking the generated code apart has
been what I use.
More information about the Digitalmars-d-announce
mailing list