www.digitalmars.com [Home] [Search] [DMDScript]

Last update Aug 9, 2002


DMDScript

What is DMDScript?

DMDScript is Digital Mars' implementation of the ECMA 262 scripting language. Netscape's implementation is called JavaScript, Microsoft's implementation is called JScript. DMDScript is much faster than other implementations, which you can verify with the included benchmark.

Note: DMDScript is not the D Programming Language, nor is it Java.

Here is the FAQ for ECMAScript.

Key Benefits of DMDScript


Installing DMDScript on Windows

Download DMDScript for Win32.

Files:

dscript.dll Digital Mars' DMDScript interpreter for COM
treatas.exe Convince Explorer to run DMDScript
ds.exe Standalone console version of DMDScript
sieve.html Benchmark speed of script engine, compare for yourself!
sieve.ds Benchmark speed of standalone script engine, compare for yourself!

Installing DMDScript to run under Explorer

Explorer usually is configured to use Microsoft JScript as its ECMAscript interpreter. To configure Explorer to run DMDScript instead:
  1. Close all browser windows.
  2. Execute the following commands:
    	regsvr32 dscript.dll
    	treatas jscript dmdscript
    	
  3. Load the web page sieve.html to verify that DMDScript is running.
It is not necessary to reboot Windows.
Note: Much of the Windows user interface outside of the browser depends on Microsoft's JScript engine, and it depends on many undocumented features of JScript. These undocumented behaviors may not work with DMDScript; DMDScript is designed to handle script embedded in web pages accessed through the browser.

Switching Explorer Back to Using Jscript

To switch back to using Microsoft JScript:
  1. Close all browser windows.
  2. Execute the following commands:
    	regsvr32 /u dscript.dll
    	treatas jscript
    	
It is not necessary to reboot Windows.

Standalone Console Version of DMDScript

ds with no arguments will compile and run the dscript file test.ds. With an argument, it will compile & run that file:
	ds sieve
	
will compile and run sieve.ds. The .ds is the default extension.

Differences Between DMDScript (Digital Mars), Jscript (Microsoft) and Javascript (Netscape)

goto Statement

DMDScript implements the goto label; statement, like in C. goto is not part of the ECMA 262 v3 standard.

assert() Function

DMDScript implements the assert() function property of the Global Object. assert() throws a RuntimeError exception. If there is an argument to assert(), that argument is converted to a Boolean and a RuntimeError exception is thrown if the argument is false.

__proto__ Property

Javascript supports the __proto__ property. Neither ECMA nor Jscript nor DMDScript supports it.

Conditional Compilation

JScript's conditional compilation statements are not supported by DMDScript, Javascript, nor ECMA.
Copyright (c) 1999-2002 by Digital Mars, All Rights Reserved