Re:New C# to Javascript compiler released
by scorcher on Monday September 03, 2012 @09:19AM
(#4470243)
I don't really get this. Surely JavaScript and C# are so hugely different that any converted code would be horrific? Wouldn't it be simpler to just write JavaScript in JavaScript?
[ Parent
| on HN ]
Re:New C# to Javascript compiler released
by jeswin on Monday September 03, 2012 @10:15AM
(#4470424)
- Translating a statically-typed Object Oriented language to JS wouldn't produce hugely different (/horrific) code. From inheritance to lambdas, there are comparable features available in JS. Going from JS to C# might be harder though.
- It might be simpler to write JS, but I can imagine people wanting to see if type-safety has benefits.
Re:New C# to Javascript compiler released
by erik-kallen on Monday September 03, 2012 @10:17AM
(#4470430)
That's right, it doesn't get horrific until you use goto or yield (which don't exist in Javascript so they have to be emulated).
Re:New C# to Javascript compiler released
by TazeTSchnitzel on Monday September 03, 2012 @11:02AM
(#4470587)
Some browsers, and ES Harmony, have yield. You could add a compiler switch to use native support, although only Firefox seems to support this just now.
Curious to see how you managed the emulation - splitting up a function? Web workers? :)
Re:New C# to Javascript compiler released
by erik-kallen on Monday September 03, 2012 @11:06AM
(#4470605)
for (;;), continue and switch.