No Clean Feed - Stop Internet Censorship in Australia
«
»

AS3, Flash

why are anonymous closures so ugly in as3?

04.07.08 | 4 Comments

AS3 is a big improvement over AS2. But it feels very 20th century compared to languages like Ruby. For instance, in AS3:

new Array(a, b, c, d).forEach(
function(o:*, idx:int, arr:Array):void {
trace(o);
}, this
);

… is kind of nicer than a for loop, but not much nicer. Why do we need to know the array index and have a reference to the array for every closure? We shouldn’t have to, but we get runtime exceptions if we try to leave those arguments out.

I hanker after elegant, concise syntax like Ruby’s:

[a, b, c, d].each { |o| print o + "\n" }

That’s my thought for the day.

related

4 Comments

have your say

Add your comment below, or trackback from your own site. Subscribe to these comments.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

:

:


«
»
Close
E-mail It