Re:Lisp interpreter made with Action Script 3.
by Zak on Wednesday August 22, 2007 @01:44PM
(#45277)
That's the first time I've looked at ActionScript code. Javascript has such an elegant object system - they should have kept it.
[ Parent
| on HN ]
Re:Lisp interpreter made with Action Script 3.
by spiralhead on Wednesday August 22, 2007 @02:35PM
(#45291)
Could be wrong but I think you can still use the prototype syntax if you want.
Re:Lisp interpreter made with Action Script 3.
by ascw on Wednesday August 22, 2007 @03:46PM
(#45320)
I know that the prototype syntax is available in as2, but I think it was removed in as3. I agree that the prototype syntax is more elegant, but I really believe Adobe was trying to appeal to Java and .NET developers.
Re:Lisp interpreter made with Action Script 3.
by spiralhead on Wednesday August 22, 2007 @04:17PM
(#45335)
"but I think it was removed in as3"
Wrong. I was curious so i tested it (i've been experimenting with Flex 2). The following code outputs "blah blah":
var foo:Function = function() {}
foo.prototype.someMethod = function() { trace("blah blah"); }
new foo().someMethod();
I think the prototype syntax was kept to maintain backwards compatibility.
Re:Lisp interpreter made with Action Script 3.
by ascw on Wednesday August 22, 2007 @04:23PM
(#45340)
Thats cool, does it work with creating classes that way as well?
Re:Lisp interpreter made with Action Script 3.
by spiralhead on Wednesday August 22, 2007 @10:28PM
(#45467)
im assuming the above code is equivalent to:
class foo {
public function someMethod() { trace("blah blah"); }
}new foo().someMethod();
just different approaches to the same problem