Re:"Move" — a simpler programming language as a subset of Ja...
by Maro on Monday February 14, 2011 @05:14AM
(#2216197)
I don't think Javascript being too complicated is a real world problem.
[ Parent
| on HN ]
Re:"Move" — a simpler programming language as a subset of Ja...
by KeithMajhor on Monday February 14, 2011 @06:38AM
(#2216381)
Javascript isn't complicated but it does have some ugly boiler-plate. I would love to see C# style lambda's in Javascript.
C# style: var item_names = $( "li.menu_item span" ).map( x => x.innerHTML )
JS style: var item_names = $( "li.menu_item span" ).map( function( x ) { return x.innerHTML } )
Re:"Move" — a simpler programming language as a subset of Ja...
by Skofoo on Monday February 14, 2011 @09:49AM
(#2216901)
CoffeeScript has C#-esque lambdas.
item_names = $("li.menu_item span").map (x) -> x.innerHTML
Re:"Move" — a simpler programming language as a subset of Ja...
by silverlake on Monday February 14, 2011 @09:59AM
(#2216935)
yeah, but the parser is messed up because it is whitespace sensitive. This would fail: compose (x)-> f(x) (y)-> g(y).
Re:"Move" — a simpler programming language as a subset of Ja...
by lhorie on Monday February 14, 2011 @02:57PM
(#2218344)
javascript 1.8:
$("li.menu_item span").map(function(x) x.innerHTML)
for that particular exaple, you could also steal pluck() from Prototype.js:
$("li.menu_item span").pluck("innerHTML")