www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Announcing DMDScript for D!

reply "Walter" <newshound digitalmars.com> writes:
At last, D now has its own scripting language, DMDScript! DMDScript is an
implementation of the ECMA 262 scripting language (also known as
javascript). The engine is written 100% in D, comes with full source code,
and linkable libraries for Windows and linux. This means that any D
application for which adding on scripting capability makes sense can now do
it.

If you examine the D source for DMDScript, some remarkable characteristics
are apparent. The first is how portable it is - almost zero versioning
between Windows and linux builds. Next is how compact it is. Did you ever
think a full, professional ECMA scripting engine could be expressed in so
few lines of code? So what about performance, you might say? Doesn't compact
code come at a price of slow performance?

Try the benchmarks yourself (sieve.ds and sieve.html), comparing DMDScript
(by running sieve.ds) with the scripting engine in your browser (by loading
sieve.html into your browser). Post the numbers here!

Isn't D, with all its compactness and expressiveness, necessarilly slower
than C++? DMDScript in D is a translation from DMDScript in C++. The D
version runs faster!

DMDScript in D provides a shakedown cruise for the D programming language,
being a substantial, professional quality application, proving that D has
what it takes to outperform C++ in both programmer productivity and
resulting application efficiency.

DMDScript in D comes with open source under the GPL license. Licenses are
available for purchase from Digital Mars for use in commercial, closed
source applications.

-Walter
www.digitalmars.com/dscript/ DMDScript scripting engine in D!
Jan 19 2005
next sibling parent "Charles" <no email.com> writes:
 www.digitalmars.com/dscript/ DMDScript scripting engine in D!

Server down ? Charlie "Walter" <newshound digitalmars.com> wrote in message news:csmgiq$bdr$1 digitaldaemon.com...
 At last, D now has its own scripting language, DMDScript! DMDScript is an
 implementation of the ECMA 262 scripting language (also known as
 javascript). The engine is written 100% in D, comes with full source code,
 and linkable libraries for Windows and linux. This means that any D
 application for which adding on scripting capability makes sense can now

 it.

 If you examine the D source for DMDScript, some remarkable characteristics
 are apparent. The first is how portable it is - almost zero versioning
 between Windows and linux builds. Next is how compact it is. Did you ever
 think a full, professional ECMA scripting engine could be expressed in so
 few lines of code? So what about performance, you might say? Doesn't

 code come at a price of slow performance?

 Try the benchmarks yourself (sieve.ds and sieve.html), comparing DMDScript
 (by running sieve.ds) with the scripting engine in your browser (by

 sieve.html into your browser). Post the numbers here!

 Isn't D, with all its compactness and expressiveness, necessarilly slower
 than C++? DMDScript in D is a translation from DMDScript in C++. The D
 version runs faster!

 DMDScript in D provides a shakedown cruise for the D programming language,
 being a substantial, professional quality application, proving that D has
 what it takes to outperform C++ in both programmer productivity and
 resulting application efficiency.

 DMDScript in D comes with open source under the GPL license. Licenses are
 available for purchase from Digital Mars for use in commercial, closed
 source applications.

 -Walter
 www.digitalmars.com/dscript/ DMDScript scripting engine in D!

Jan 19 2005
prev sibling next sibling parent reply Kris <Kris_member pathlink.com> writes:
In article <csmgiq$bdr$1 digitaldaemon.com>, Walter says...
DMDScript in D provides a shakedown cruise for the D programming language,
being a substantial, professional quality application, proving that D has
what it takes to outperform C++ in both programmer productivity and
resulting application efficiency.

Walter, Did you intend to imply that all past efforts, written thus far in D, did not provide a "shakedown cruise"? Or are somehow not subtantial, professional-quality applications? Or did not already prove that D has what it takes ... ? It's interesting to see you do something like this, but I'm more than a little surprised at the language utilized here -- it can rather easily be interpreted as "this is the first time anything of value has been done with D" ... followed by lots of big exclamation marks I sure hope you didn't intent it to come off in this manner. There again, I suspect the vast majority of this newsgroup already /knows/ all of these things about D. What gives?
Jan 19 2005
next sibling parent reply "Walter" <newshound digitalmars.com> writes:
"Kris" <Kris_member pathlink.com> wrote in message
news:csmtcs$sao$1 digitaldaemon.com...
 In article <csmgiq$bdr$1 digitaldaemon.com>, Walter says...
DMDScript in D provides a shakedown cruise for the D programming


being a substantial, professional quality application, proving that D has
what it takes to outperform C++ in both programmer productivity and
resulting application efficiency.

Walter, Did you intend to imply that all past efforts, written thus far in D, did

 provide a "shakedown cruise"? Or are somehow not subtantial,
 professional-quality applications? Or did not already prove that D has

 takes ... ?

 It's interesting to see you do something like this, but I'm more than a

 surprised at the language utilized here -- it can rather easily be

 as "this is the first time anything of value has been done with D" ...

 by lots of big exclamation marks

 I sure hope you didn't intent it to come off in this manner. There again,

 suspect the vast majority of this newsgroup already /knows/ all of these

 about D. What gives?

I'm sorry, it didn't occur to me that it would be interpreted that way. I meant it as a comparison with C++ using a substantial app written in both C++ and D. There are other substantial apps in D, but as far as I know, they aren't directly comparable to C++ apps, so a comparison is apples and oranges. DMDScript is a translation from a C++ product, so it enabled me to do a side-by-side comparison of the two languages using substantial code I know intimately, something I haven't been able to do so far. I'm pretty thrilled with the results, as D came off a winner by just about every measure. My enthusiasm got the better of me when I wrote that piece!
Jan 19 2005
parent Kris <Kris_member pathlink.com> writes:
In article <csmvf7$ujs$1 digitaldaemon.com>, Walter says...
I'm sorry, it didn't occur to me that it would be interpreted that way. I
meant it as a comparison with C++ using a substantial app written in both
C++ and D. There are other substantial apps in D, but as far as I know, they
aren't directly comparable to C++ apps, so a comparison is apples and
oranges. 

OK; although there are comparable apps (such as HTTP-servers, Servlet-style engines, and others) that have been around for quite some time, and which bathe D in a suitably favourable light. Those could be considered apples-to-apples, but perhaps as Golden-Delicious vs Orange-Pippins? BTW: did you make extensive use of class-Interfaces, method-overloading, or anything related? How about DLLs? If so, you'd have undoubtably run into the same problems that those of us writing large quantities of D have taken issue with :-) The point is that one rarely runs into such problems until working with a project of significance, designed with some of that professional-quality you speak of. I'd like to encourage you to attempt building a framework that cannot be statically linked. Perhaps then you'd be a bit more sympathetic to all those requests regarding DLLs and a single GC instance :-) - Kris
Jan 19 2005
prev sibling parent John Reimer <brk_6502 yahoo.com> writes:
Yes, I was also a little confused by that paragraph.  Good to see the 
meaning clarified.

Kris wrote:
 In article <csmgiq$bdr$1 digitaldaemon.com>, Walter says...
 
DMDScript in D provides a shakedown cruise for the D programming language,
being a substantial, professional quality application, proving that D has
what it takes to outperform C++ in both programmer productivity and
resulting application efficiency.

Walter, Did you intend to imply that all past efforts, written thus far in D, did not provide a "shakedown cruise"? Or are somehow not subtantial, professional-quality applications? Or did not already prove that D has what it takes ... ? It's interesting to see you do something like this, but I'm more than a little surprised at the language utilized here -- it can rather easily be interpreted as "this is the first time anything of value has been done with D" ... followed by lots of big exclamation marks I sure hope you didn't intent it to come off in this manner. There again, I suspect the vast majority of this newsgroup already /knows/ all of these things about D. What gives?

Jan 19 2005
prev sibling next sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Walter wrote:
<snip>
 Try the benchmarks yourself (sieve.ds and sieve.html), comparing DMDScript 
 (by running sieve.ds) with the scripting engine in your browser (by loading 
 sieve.html into your browser). Post the numbers here!

I suppose we should benchmark different browsers, and see how many of them come close to DMDScript.
 Isn't D, with all its compactness and expressiveness, necessarilly slower 
 than C++?  DMDScript in D is a translation from DMDScript in C++. The D
 version runs faster!

Yes, maybe scripting language implementations tend to benefit considerably from GC. FTM, what does the second D in DMDScript stand for? Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jan 20 2005
parent "Walter" <newshound digitalmars.com> writes:
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message
news:cso67f$2g3u$1 digitaldaemon.com...
 FTM, what does the second D in DMDScript stand for?

Generally I was googling on *script names, looking for one I could use.
Jan 20 2005
prev sibling parent reply "Ben Hinkle" <bhinkle mathworks.com> writes:
"Walter" <newshound digitalmars.com> wrote in message
news:csmgiq$bdr$1 digitaldaemon.com...
 At last, D now has its own scripting language, DMDScript! DMDScript is an
 implementation of the ECMA 262 scripting language (also known as
 javascript). The engine is written 100% in D, comes with full source code,
 and linkable libraries for Windows and linux. This means that any D
 application for which adding on scripting capability makes sense can now

 it.

Sounds cool. Is there an API to the dscript engine? I can't tell browsing the source directory how to plug it into an application.
Jan 20 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Ben Hinkle" <bhinkle mathworks.com> wrote in message
news:csp2t6$ljb$1 digitaldaemon.com...
 "Walter" <newshound digitalmars.com> wrote in message
 news:csmgiq$bdr$1 digitaldaemon.com...
 At last, D now has its own scripting language, DMDScript! DMDScript is


 implementation of the ECMA 262 scripting language (also known as
 javascript). The engine is written 100% in D, comes with full source


 and linkable libraries for Windows and linux. This means that any D
 application for which adding on scripting capability makes sense can now

 it.

Sounds cool. Is there an API to the dscript engine? I can't tell browsing the source directory how to plug it into an application.

To add a function, just add it in like the ones in dglobal.d. To create a new object type, I'd just copy the code in protoerror.d and modify it to suit.
Jan 20 2005
parent reply Chris Sauls <Chris_member pathlink.com> writes:
In article <csp4pm$o45$4 digitaldaemon.com>, Walter says...
To add a function, just add it in like the ones in dglobal.d. To create a
new object type, I'd just copy the code in protoerror.d and modify it to
suit.

Think one day the DMDScript engine will be available as a truly just-link-in library? I can't help dreaming of code like: # # private import etc.dmdscript.dmdscript; // or... something # # static this() { # // Where Foo is a class implementing some standard interface # // Maybe IScriptObject or the like # DMDScript.registerObject("Foo", &(Foo.scriptFactory)); # } # Any chance of it? Or is that do-able now with some boilerplate? -- Chris Sauls
Jan 20 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Chris Sauls" <Chris_member pathlink.com> wrote in message
news:csp9vu$v61$1 digitaldaemon.com...
 In article <csp4pm$o45$4 digitaldaemon.com>, Walter says...
To add a function, just add it in like the ones in dglobal.d. To create a
new object type, I'd just copy the code in protoerror.d and modify it to
suit.

Think one day the DMDScript engine will be available as a truly

 library?  I can't help dreaming of code like:
 #
 #  private import etc.dmdscript.dmdscript; // or... something
 #
 #  static this() {
 #    // Where Foo is a class implementing some standard interface
 #    // Maybe IScriptObject or the like
 #    DMDScript.registerObject("Foo", &(Foo.scriptFactory));
 #  }
 #

 Any chance of it?  Or is that do-able now with some boilerplate?

It's doable now. Look at protoerror.d.
Jan 20 2005
parent reply Chris Sauls <Chris_member pathlink.com> writes:
In article <cspks9$1c6h$2 digitaldaemon.com>, Walter says...
"Chris Sauls" <Chris_member pathlink.com> wrote in message
news:csp9vu$v61$1 digitaldaemon.com...
 #  private import etc.dmdscript.dmdscript; // or... something
 #
 #  static this() {
 #    // Where Foo is a class implementing some standard interface
 #    // Maybe IScriptObject or the like
 #    DMDScript.registerObject("Foo", &(Foo.scriptFactory));
 #  }
 #

 Any chance of it?  Or is that do-able now with some boilerplate?

It's doable now. Look at protoerror.d.

Well today I did get around to looking at it, and attempted to add a class to DMDScript, without editing the engine.. And after only an hour of experimenting, can declare 100% succes! I think I know of a few projects (such as my friend's bittorrent client, and our envisioned 100% D MUD server) which could benefit from this... To show what I accomplished, I got the following DMDScript to execute, with the shown output. Obviously "Monkey" is the class I added. dsext.ds # # var helloStr = "Hello world! (from DMDScript!!!)"; # print("\n", helloStr, "\n"); # # var monkey = new Monkey; # # println(monkey); # println("monkey.furColor = \"", monkey.furColor, "\""); # println("monkey.hungry = ", monkey.hungry); # println("Calling monkey.eatBanana()"); # monkey.eatBanana(); # println("monkey.hungry = ", monkey.hungry); # output # # Hello world! (from DMDScript!!!) # [object Monkey] # monkey.furColor = "brown" # monkey.hungry = 1 # Calling monkey.eatBanana() # monkey.hungry = 0 # You should really write up an official how-to on this, though... I'm sure there's some things I'm missing yet, even though it works. Meanwhile, thanks for quite a nifty new tool! -- Chris Sauls
Jan 22 2005
parent reply "Walter" <newshound digitalmars.com> writes:
Nice! How about posting monkey.d here?

"Chris Sauls" <Chris_member pathlink.com> wrote in message
news:csut90$1te8$1 digitaldaemon.com...
 In article <cspks9$1c6h$2 digitaldaemon.com>, Walter says...
"Chris Sauls" <Chris_member pathlink.com> wrote in message
news:csp9vu$v61$1 digitaldaemon.com...
 #  private import etc.dmdscript.dmdscript; // or... something
 #
 #  static this() {
 #    // Where Foo is a class implementing some standard interface
 #    // Maybe IScriptObject or the like
 #    DMDScript.registerObject("Foo", &(Foo.scriptFactory));
 #  }
 #

 Any chance of it?  Or is that do-able now with some boilerplate?

It's doable now. Look at protoerror.d.

Well today I did get around to looking at it, and attempted to add a class

 DMDScript, without editing the engine..  And after only an hour of
 experimenting, can declare 100% succes!  I think I know of a few projects

 as my friend's bittorrent client, and our envisioned 100% D MUD server)

 could benefit from this...

 To show what I accomplished, I got the following DMDScript to execute,

 shown output.  Obviously "Monkey" is the class I added.

 dsext.ds
 #
 #  var helloStr = "Hello world! (from DMDScript!!!)";
 #  print("\n", helloStr, "\n");
 #
 #  var monkey = new Monkey;
 #
 #  println(monkey);
 #  println("monkey.furColor = \"", monkey.furColor, "\"");
 #  println("monkey.hungry = ", monkey.hungry);
 #  println("Calling monkey.eatBanana()");
 #  monkey.eatBanana();
 #  println("monkey.hungry = ", monkey.hungry);
 #

 output
 #
 #  Hello world! (from DMDScript!!!)
 #  [object Monkey]
 #  monkey.furColor = "brown"
 #  monkey.hungry = 1
 #  Calling monkey.eatBanana()
 #  monkey.hungry = 0
 #

 You should really write up an official how-to on this, though...  I'm sure
 there's some things I'm missing yet, even though it works.  Meanwhile,

 for quite a nifty new tool!

 -- Chris Sauls

Jan 22 2005
parent reply Chris Sauls <ibisbasenji gmail.com> writes:
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Walter wrote:
 Nice! How about posting monkey.d here?

Actually its 'dsext.d' but I will do / have done. It isn't much... but I think based on this I should be able to find a nice smooth way of doing it. A friend and I are thinking we could combine it with Sofu to create classes from files. :) Yes we do get bored sometimes. -- Chris Sauls
Jan 22 2005
parent "Walter" <newshound digitalmars.com> writes:
Thanks!
Jan 24 2005