Re:The new Microsoft Edge is out of preview
by goto11 on Thursday January 16, 2020 @03:15AM
(#22062565)
What can you express in JavaScript which you cant express in C#?
[ Parent
| on HN ]
Re:The new Microsoft Edge is out of preview
by jammygit on Thursday January 16, 2020 @01:47PM
(#22067572)
Serialization for one thing. You can work with JSON extremely freely without creating weird serializable classes for every combination of data you might need to work with - eg, no class named "DoodadList" for when you want to de-serialize a JSON list (maybe that's a Unity3D thing?).
You can nest functions nicely and work with closures when it makes sense, if you like that sort of thing.
The async programming model is also really nice to work with.
You also don't need to create classes for every noun, verb, and adjective in your system either - when all you need is a function, you just write a function, not some weird object to hold it.
You also don't have to write a f after all of your decimal values to tell the silly compiler that you mean for 0.25 to be a float. (this one truly does not matter, but there are a lot of little things like this that add up)
I know you can do a lot of that in C#, but its just so effortless in javascript. You just need to be more disciplined about how you code it
Re:The new Microsoft Edge is out of preview
by goto11 on Friday January 17, 2020 @04:41AM
(#22073277)
You are right about having to create a class to hold a function, that is annoying. But C# do support nested functions and closures. I don't really understand your other points. A literal 0.25 in C# will be parsed as a double precision. If you want it to be a float (less precision) you use the F postfix. But JavaScript doesn't even have the float/double distinction.
Re:The new Microsoft Edge is out of preview
by svecoldr on Saturday January 18, 2020 @04:34AM
(#22083429)
What can you express in C# which you cant express in Assembler?
Re:The new Microsoft Edge is out of preview
by goto11 on Tuesday January 21, 2020 @01:33AM
(#22104740)
Expressions and functions for example. Assembler is really low level, it doesn't even have control structures. But C# seem to have everything JavaScript has and much more, so I just wondered why the parent post found JavaScript more expressive.