On Mon, 2008-03-24 at 19:43 -0700, Darryl wrote: > It'd also be nice to have non-mandatory function call parens like in > Ruby
No it wouldn't. Functions get passed around a hell of a lot more in
Javascript than they do in Ruby, which means that you'd need to rely on
something akin to Ruby's Object#method(symbol) function all the time.
> ...and to have blocks-as-objects like in Ruby. Both of these things
> make Ruby delightfully easy to read.
Would JS2 special case the last argument to a function like Ruby does?
Ruby's block syntax is nice, but it's not without its problems. Take for
instance the fact that a method *must* be defined with the last argument
prefixed by an ampersand if you'd like it to accept a block.
As you said, you could emulate the Ruby iteration pattern by doing the
following:
Number.prototype.times = function(func) {
for (var i = 0; i < this; i++ ) {
func.call();
}
}
Number(5).times(function(){
alert("Foo!");
});
I don't see this as a problem, and that's coming from someone who
develops with Ruby/Rails, Javascript & Actionscript 3. If you want to
write as much as possible in Ruby, you can always go the post-processing
route.
Cheers,
--
Nathan de Vries
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
