ToDo:
µ¤¤¬¤Ä¤¤¤¿¤é³ä¤È¤¿¤¯¤µ¤ó¤¢¤ë¡£
i@u ~> /bin/ls -1 arch/hyperestraier-* arch/hyperestraier-0.3.13.tar.gz arch/hyperestraier-0.5.0.tar.gz arch/hyperestraier-0.5.1.tar.gz arch/hyperestraier-0.5.2.tar.gz arch/hyperestraier-0.5.3.tar.gz arch/hyperestraier-0.5.7.tar.gz arch/hyperestraier-0.9.0.tar.gz arch/hyperestraier-0.9.1.tar.gz arch/hyperestraier-0.9.2.tar.gz arch/hyperestraier-1.0.0.tar.gz arch/hyperestraier-1.0.1.tar.gz arch/hyperestraier-1.0.2.tar.gz arch/hyperestraier-1.0.3.tar.gz arch/hyperestraier-1.0.6.tar.gz arch/hyperestraier-1.1.0-experimental.tar.gz arch/hyperestraier-1.1.6.tar.gz arch/hyperestraier-1.2.0-experimental.tar.gz arch/hyperestraier-1.2.1.tar.gz arch/hyperestraier-1.2.2.tar.gz arch/hyperestraier-1.2.3.tar.gz
¤·¤ç¤Ã¤Á¤å¤¦¾Ã¤¹¤»¤¤¤«¡¢°Æ³°¤¹¤¯¤Ê¤¤¡£
i@u ~> /bin/ls -1 arch/gcc-* arch/gcc-1.42.tar.gz arch/gcc-core-4.0.3.tar.bz2 arch/gcc-g++-3.4.0.tar.bz2 arch/gcc-g++-4.0.0.tar.bz2 arch/gcc-g++-4.0.2.tar.bz2 arch/gcc-g++-4.0.3.tar.bz2 arch/gcc-java-3.4.0.tar.bz2 arch/gcc-java-4.0.2.tar.bz2 arch/gcc-java-4.0.3.tar.bz2 arch/gcc-objc-4.0.2.tar.bz2
(08:04)
http://www.kmonos.net/alang/etc/ecmascript.php
¤ÎÎã¤ò¤«¤¿¤Ã¤Ñ¤·¤«¤é¼Â¹Ô¡£
ƿ̾´Ø¿ô¤ò () ¤Ç°Ï¤Ã¤Æ¤Û¤²¤ì¤Ê¤¤¡¢¤Î¤«¤Ê¡£
i@u ~/test/js> cat ki10.ds var x = ( function(a, b) { return (a==0 ? b : arguments.callee(b%a, a)); } )( 60, 84 ); println( x ); i@u ~/test/js> ds ki10.ds Digital Mars DMDScript 1.10 www.digitalmars.com Compiled by Digital Mars DMD D compiler Copyright (c) 1999-2006 by Digital Mars written by Walter Bright 1 source files Error: (1) : Error: cannot assign to function (a,b) { return b ? arguments.callee(b % a, a); } i@u ~/test/js> cat ki11.ds var f = function(a, b) { return (a==0 ? b : arguments.callee(b%a, a)); } var x = f( 60, 84 ); println( x ); i@u ~/test/js> ds ki11.ds Digital Mars DMDScript 1.10 www.digitalmars.com Compiled by Digital Mars DMD D compiler Copyright (c) 1999-2006 by Digital Mars written by Walter Bright 1 source files 12
closure ¤¬Ìµ¤¤¤Î¤«¤Í¡£
i@u ~/test/js> cat ki12.ds function map( arr, f ) { var newArr = new Array(arr.length); for( var i=0; i<arr.length; ++i ) newArr[i] = f( arr[i] ); return newArr; } function mem_fn( mf ) { println('OUTSIDE: ' + mf); return function(obj) { println('INSIDE: ' + mf); var args = new Array(arguments.length-1); for( var i=1; i<arguments.length; ++i ) args[i-1] = arguments[i]; return mf.apply( obj, args ); }; } x = map( ['hoge', 'fuga', 'hagyo'], mem_fn( String.prototype.toUpperCase ) ); map( x, println ); i@u ~/test/js> ds ki12.ds Digital Mars DMDScript 1.10 www.digitalmars.com Compiled by Digital Mars DMD D compiler Copyright (c) 1999-2006 by Digital Mars written by Walter Bright 1 source files OUTSIDE: function toUpperCase() { [native code] } INSIDE: undefined Error: Undefined undefined.apply is undefined and has no Call method
´Ø¿ô¤Ë name ¥á¥½¥Ã¥É¤¬Ìµ¤¤¤«¤·¤é¡£
i@u ~/test/js> cat ki14.ds function Point() { this.x = 0; this.y = 0; this.distanceFromOrigin = function() { return Math.sqrt( this.x*this.x + this.y*this.y ); } } var pt = new Point(); pt.x = 5; pt.y = -12; println( pt.distanceFromOrigin() ); println( pt.constructor ); println( pt.constructor.name ); i@u ~/test/js> ds ki14.ds Digital Mars DMDScript 1.10 www.digitalmars.com Compiled by Digital Mars DMD D compiler Copyright (c) 1999-2006 by Digital Mars written by Walter Bright 1 source files 13 function Point() { } undefined
¤³¤Ã¤Á¤Ï closure ¤Ý¤¯Æ°¤¯¤Ê¡£
i@u ~/test/js> cat ki16.ds function Point() { var x = 0; var y = 0; this.getX = function() { return x; } this.getY = function() { return y; } this.set = function(i_x, i_y) { x=i_x; y=i_y; } } var pt = new Point(); pt.set(100, 200); println( pt.getX() + ' ' + pt.getY() ); i@u ~/test/js> ds ki16.ds Digital Mars DMDScript 1.10 www.digitalmars.com Compiled by Digital Mars DMD D compiler Copyright (c) 1999-2006 by Digital Mars written by Walter Bright 1 source files 100 200
scope chain ¤ÎÏᢤÎÉôʬ¤âÅöÁ³¤À¤á¡£ closure ·ÏÈᤷ¤¹¡£
MS ³ÈÄ¥¤é¤·¤¤¤¬Æ°¤¯¡£
i@u ~/test/js> cat ki24.ds // written for JScript.NET function Point() { this.x = 0.0; this.y = 0.0; } function Point.prototype.distanceFromOrigin() { return this.x*this.x + this.y*this.y; } println( (new Point()).distanceFromOrigin() ); i@u ~/test/js> ds ki24.ds Digital Mars DMDScript 1.10 www.digitalmars.com Compiled by Digital Mars DMD D compiler Copyright (c) 1999-2006 by Digital Mars written by Walter Bright 1 source files 0
arity ¤â¤¢¤ë¤ß¤¿¤¤¡£
i@u ~/test/js> cat ki25.ds // written for Rhino function add(x, y) { return x + y; } println( add.arity ); i@u ~/test/js> ds ki25.ds Digital Mars DMDScript 1.10 www.digitalmars.com Compiled by Digital Mars DMD D compiler Copyright (c) 1999-2006 by Digital Mars written by Walter Bright 1 source files 2
__proto__ ¤Ï¤Ê¤¤¡£
i@u ~/test/js> cat ki26.ds // written for Rhino var objA = { f: function(){print("objA")} } var objB = { f: function(){print("objB")} } var objC = new Object(); var objD = new Object(); var objE = new Object(); objD.__proto__ = objE.__proto__ = objC; objC.__proto__ = objA; // C¤Î¥×¥í¥È¥¿¥¤¥×Êѹ¹ objD.f(); objE.f(); objC.__proto__ = objB; // C¤Î¥×¥í¥È¥¿¥¤¥×Êѹ¹ objD.f(); objE.f(); i@u ~/test/js> ds ki26.ds Digital Mars DMDScript 1.10 www.digitalmars.com Compiled by Digital Mars DMD D compiler Copyright (c) 1999-2006 by Digital Mars written by Walter Bright 1 source files Error: Object [object Object].f is undefined and has no Call method
a.caller ¤â̵¤¤¤ß¤¿¤¤¤Í¡£
// written for MocaScript function f1() { f2(); } function f2() { f3(); } function f3() { f4(); } function f4() { f5(); } function f5() { g(); } function g() { for(var a=arguments; a; a=a.caller) // ¸Æ¤Ó½Ð¤·¸µ¤ò½ç¤Ë¤¿¤É¤ë if( a.callee == f1 ) // ¸Æ¤Ó½Ð¤µ¤ì´Ø¿ô¤¬f1¤Ê¤é¡Ä¡© println("g was called inside f1"); } f1(); i@u ~/test/js> ds ki27.ds Digital Mars DMDScript 1.10 www.digitalmars.com Compiled by Digital Mars DMD D compiler Copyright (c) 1999-2006 by Digital Mars written by Walter Bright 1 source files
(09:00)
import dmdscript.script; void* Dglobal_hello(Dobject pthis, CallContext *cc, Dobject othis, Value* ret, Value[] arglist) { writef("hello\n"); return null; } int main() { static char[] TEXT_hello = "hello"; static NativeFunctionData nfd[] = [ { &TEXT_hello, &Dglobal_hello }, ]; Program p = new Program(); DnativeFunction.init(p.callcontext.global, nfd, DontEnum); p.compile(`test1`, `println('hello1'); hello();`, null); p.execute(null); return 0; }
compile ¤¹¤ë¤´¤È¤ËÊ̤ξõÂ֤ˤʤë¤Î¤Ç¡¢ Web ¤Ê¤ó¤«¤Ç»È¤Ã¤Æ¤ë JS Ū¤Ê¡¢ ¾õÂÖ»ý¤¿¤»¤Æ¤Á¤ç¤Ã¤È¤º¤ÄÁö¤é¤»¤ë¤È¤«¤Ç¤¤ó¤Ý¤¤¡£
¤¦¡¼¤ó¡¢»È¤¨¤Ê¤¤¡Ä
(09:42)
Ëͤϥâ¥Ê¥É¤Î¾Ï¤Î°úÍѤ¬ ¥Ç¥£¥¢¥¹¥Ý¥é¤À¤Ã¤¿¤Î¤Ç¤¦¤Ã¤«¤ê¾×Æ°Ç㤤¤·¤Æ¤·¤Þ¤Ã¤¿¡£
À¤´ÖŪ¤Ë¤Ï¤Õ¤Ä¤±¤ë¤ÎÊý¤¬¿Íµ¤¤Ê¤Î¤«¤·¤é¡£ ¤È¤ê¤¢¤¨¤º¡¢¤¢¤ëÄøÅ٤Ϥ狼¤Ã¤Æ¤¤¤¿¤Ç¤¢¤í¤¦ËÍ¤Ë¤Ï ¤ï¤«¤ê¤ä¤¹¤¤¤Ê¤¡¡£ 1ǯÁ°¤ÎËͤʤé¤Á¤ç¤¤¥¥Ä¤«¤Ã¤¿¤«¤â¤À¤±¤É¡£
(23:19)
Á° | 2006ǯ 6·î |
¼¡ | ||||
Æü | ·î | ²Ð | ¿å | ÌÚ | ¶â | ÅÚ |
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |
Á´¤Æ¥ê¥ó¥¯¥Õ¥ê¡¼¤Ç¤¹¡£ ¥³¡¼¥ÉÊҤϼ«Í³¤Ë»ÈÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¹½¤¤¤Þ¤»¤ó¡£ ¤½¤Î¾¤Î¤â¤Î¤ÏGPL°·¤¤¤Ç¤¢¤ì¤Ð¤¢¤é¤æ¤ë»ÈÍѤ˴ؤ·¤Æʸ¶ç¤Ï¸À¤¤¤Þ¤»¤ó¡£ ¤Ê¤Ë¤«¤¢¤ì¤Ð²¼µ¥á¡¼¥ë¥¢¥É¥ì¥¹¤Ø¡£