Re: DMDScript now under Boost license
On 3/29/10, Robert Clipsham rob...@octarineparrot.com wrote: I seem to recall it is, and a fairly old D1 at that... You could always update it and send a patch Walter's way, see if he accepts it :) Walter seems to have fixed it up the the new D1; it compiled there. And I just spent the day making a port to D2. There's a few WTFs in there though, which I hacked around. Here it is: http://arsdnet.net/dcode/dmdscript_d2.zip First, once each in dobject.d and script.d, I casted away a const. grep for FIXME. Second, and this is the big one: the assocative array implementation in there seems to have broken entirely with the switch to D2. Look for BIG HACK in property.d - I had to do this two times: assert(key !is null); p = *key in table; // BIG HACK! in seems broken! if(p is null) foreach(k,ref v; table) { if(k.toString() == key.toString()) { p = v; // WTF break; } } Previously, it used a custom AA implementation, similar to the one in Phobos, but not quite the same. It cached the hashes for boosted speed. In phobos2, the AA implementation is completely different. This first manifested itself as linker errors on foreach statements (fix it by compiling as: dmd -oftest *.d instead of using the makefile). Then, I noticed obvious things were failing. After spending a few hours on it, I decided to just give up and use the above hack. I still don't understand why it is happening that way. (I thought const correctness would be the hard thing, but aside from the two casts, it was fairly easy. The stupid AA has been the real problem!) But, anyway, it now works on some simple scripts, and the asserts in there all work, so I think it is working correctly. Now, with it compiling as D2, the next step will be making the wrapper template I mentioned yesterday. I don't have time to do it today though. On the bright side, I know the code a bit better now than I ever did before, so maybe I can make this template better than I thought! We'll see.
Re: d support in codeblocks
On Mon, 29 Mar 2010 16:41:52 -0300, Matthias Pleh matthias.p...@gmx.at wrote: Am 29.03.2010 18:51, schrieb Robert Jacques: On Sun, 28 Mar 2010 16:24:30 -0300, Matthias Pleh matthias.p...@gmx.at wrote: Hey all, as I already posted in D.ide newsgroup, I am working on an improvement for D support in the codeblocks IDE. Now I've made a patch and posted it in the codeblocks forum: http://forums.codeblocks.org/index.php/topic,12246.0.html It would be cool, If there are some D user, whow can try out and test this patch. What should be done: - check out the newest sourcecode of codeblocks http://svn.berlios.de/svnroot/repos/codeblocks/trunk - apply the patch mentioned above - test the D features and report any bug, comments and wishes in the same thread as the patch. (remember, this patch is only a start!) - and of course feel free to send new patches yourself!! greets nocide This looks like a great start. However, I'm not sure which patches I should apply. The thread has couple of patches by 'bernard' but I can't seem to find the main patches by nocide. I'm probably blind, but could you point out where the links should be located? Thanks. Hello Robert, you have to log in to see the attached files. So just register and login :) Ther are 2 files attached in the 1.post. * d_win_v2.patch * d_nix_v2.patch - for *nix (it's really the same, just *nix lineendings) If you have further questions, don't hesistate to ask again! greets nocide Thanks. I got a build working and have tested it out. It seems that you've made a substantial change to the default syntax highlighting, both in the terms you use and their settings. Now, most of them I can fix to how I want, but the normal 'selected' settings are substantially better and more complex than a simple foreground and background color. Also, I'd strongly recommend keeping the current code::block standard highlighting if you're planning to have your trunk merged into the mainline tree.
Re: DMDScript now under Boost license
On 3/22/2010 3:30 AM, Walter Bright wrote: http://www.digitalmars.com/dscript/index.html Much appreciated! Also wondering how its performance compares against V8.
Re: DMDScript now under Boost license
All right, now I'm actually done for the day. Updated the zip at the link: http://arsdnet.net/dcode/dmdscript_d2.zip To add a pretty interface (pretty.d). It is incomplete, but works to play with. test.d is an example of how to use it. auto se = new ScriptEngine; se.addFunction!(fun, fun); // adding D functions is just giving the names. the second arg is required since stringof the alias kept treating it as a property. se.addFunction!(fun2, fun2); se.compile(function test(a) { println(a); }); se.call(test, 40); // and it is almost as easy to call script functions! When I go back to finish it, I'm thinking I'll add more integration with std.variant and opDispatch, so the D and javascript code basically work the same way. To do this, I did have to do one change to dmdscript itself: edited dnative.d to add an overload constructor so it can take a delegate as well as a function. That let my template just use a nested function to keep it easy. It might not work properly if the script tries to redefine the function though. Still, good enough for now. I've been at this for 9 hours! Blown my whole day off. On 3/30/10, Adam Ruppe destructiona...@gmail.com wrote: On 3/29/10, Robert Clipsham rob...@octarineparrot.com wrote: I seem to recall it is, and a fairly old D1 at that... You could always update it and send a patch Walter's way, see if he accepts it :) Walter seems to have fixed it up the the new D1; it compiled there. And I just spent the day making a port to D2. There's a few WTFs in there though, which I hacked around. Here it is: http://arsdnet.net/dcode/dmdscript_d2.zip First, once each in dobject.d and script.d, I casted away a const. grep for FIXME. Second, and this is the big one: the assocative array implementation in there seems to have broken entirely with the switch to D2. Look for BIG HACK in property.d - I had to do this two times: assert(key !is null); p = *key in table; // BIG HACK! in seems broken! if(p is null) foreach(k,ref v; table) { if(k.toString() == key.toString()) { p = v; // WTF break; } } Previously, it used a custom AA implementation, similar to the one in Phobos, but not quite the same. It cached the hashes for boosted speed. In phobos2, the AA implementation is completely different. This first manifested itself as linker errors on foreach statements (fix it by compiling as: dmd -oftest *.d instead of using the makefile). Then, I noticed obvious things were failing. After spending a few hours on it, I decided to just give up and use the above hack. I still don't understand why it is happening that way. (I thought const correctness would be the hard thing, but aside from the two casts, it was fairly easy. The stupid AA has been the real problem!) But, anyway, it now works on some simple scripts, and the asserts in there all work, so I think it is working correctly. Now, with it compiling as D2, the next step will be making the wrapper template I mentioned yesterday. I don't have time to do it today though. On the bright side, I know the code a bit better now than I ever did before, so maybe I can make this template better than I thought! We'll see.