On Sunday, 17 February 2013 at 07:53:15 UTC, Walter Bright wrote:
On 2/16/2013 7:26 PM, js.mdnq wrote:
Would it ever be possible to compile D source directly to java to take advantage of what java offers. (e.g., the ability to run d code inside a browser)

I'm not talking about necessarily fully fledged functionality(obviously stuff like asm isn't going to work) but basically the ability to use D's syntax and
some of it's compiler features(mixins, templates, etc).


Java doesn't have pointers, so right off the bat there'd be big problems.

Java does have pointers... you just can't get to them easily. At the very least, you could allocate and manage your own chunk of memory and do all the pointer arithmetic yourself on that chunk. This would require the chunk to be pinned in some way and the GC to be turned off but it is an option.

Also, have you looked much at sun.misc.Unsafe?

Or maybe one could use the JNI to write an external memory manager for each platform and all pointer arithmetic is passed through that. Of course, if one goes this far then any "javaD" would need to be able to work well with importing java libraries to be of any use.

Reply via email to