4 ms·
Throwing away all of the advantages of dynamic scripting is not the answer. We just need better webgl support in browsers.
by ilaksh 13y ago
Throwing away all of the advantages of dynamic scripting is not the answer. We just need better webgl support in browsers.
- lmm 13y agoWhat advantages would those be? Do they still apply when compared to a modern strongly-typed language with type inference and typeclass-like functionality, like Scala?
- millstone 13y agoThe big advantage of dynamic typing is that your code only needs to be correct on the code paths that are actually taken. That's important for the web, which is full of browser specific hacks, polyfills, feature detection, etc. Consider the difficulty of doing static type checking for a property like window.localStorage. Its type depends on the runtime environment, and may not exist at all. So static type checking against one browser environment doesn't give you much assurance that your code will type check in other browsers. You really do need to do type checking at runtime.
- EpicEng 13y agoYeah that's what polymorphism is for. window.localStorage would just be the interface, the underlying concrete type is irrelevant.
- millstone 13y agowindow.localStorage doesn't exist in (for example) IE 7, and it may or may not exist in IE8 depending on the domain. So you can't rely on the interface being the same.
- EpicEng 13y agoPlenty of libraries written in statically typed languages add features which may not be supported on legacy platforms. There are ways to deal with this. In version X you provide a way to let the client know that function Y is not supported on the current platform. It's not like the web is some completely different animal, it's just an example of poor/little standardization and a design which has not evolved well over time.
- millstone 13y agoMy point was not that static typing makes this stuff impossible, just more awkward and difficult.
- ilaksh 13y agoThe big advantage of dynamic typing is that you don't have to specify it, so your code is easier to write and easier to read.
- ilaksh 13y agoWhen compared to Scala? HAHAHAHAHA. Type inference that removes most types from code and provides fast native code is nice. Scala may have type inference, but it is not nice. http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/ http://overwatering.org/blog/2013/12/scala-1-star-would-not-... http://www.reddit.com/r/programming/comments/1rvltx/scala_1_would_not_program_again/ http://www.reddit.com/r/programming/comments/1rvltx/scala_1_... I like ToffeeScript, CoffeeScript, or LiveScript maybe if I am feeling smart. Scala is for sadomasochists.
- frowaway001 13y agoDid you just seriously compare languages which took JavaScript and made it even worse (e. g. lexical scoping) with a language with a working type system, traits, a coherent fusion of OOP and FP, typeclasses, higher-kinded and dependent types? Please tell me this is just a joke ...
- ilaksh 13y agoScala has waayyy too much stuff. Obviously. And its not coherent. Its a joke. ToffeeScript, CoffeeScript, and LiveScript are objectively and obviously better than JavaScript (and Scala). You and I are living in two different universes. One where programming languages are there to solve problems (my universe) and another where programming languages are there to create them or just to prove you are smart enough to use them (yours).
- frowaway001 13y agoBookmarked. This is comedy gold.