3 ms·
I am impressed at how expressive interfaces and structural sub-typing are for Javascript, even though there is still no way to express a heterogeneous array. Ho
by gregwebs 14y ago
I am impressed at how expressive interfaces and structural sub-typing are for Javascript, even though there is still no way to express a heterogeneous array. However, I have been very disappointed at how weak their type inference is and that they have no plans to improve it. http://typescript.codeplex.com/workitem/329 http://typescript.codeplex.com/workitem/329
- twp 14y agoHeterogenous arrays can have very poor performance on some JavaScript VMs, particularly Google's V8. If you can avoid them in performance sensitive code, it's a good idea to do so. For more information, see this excellent talk: http://v8-io12.appspot.com/ http://v8-io12.appspot.com/
- Locke1689 14y agoYou can't make the inference you suggest in the bug. It's not always valid. What if you set the variable in the function? This line of type inference is very problematic in languages like JavaScript. Your statement that you expected "modern type inference" makes it sound like you only have practical knowledge (maybe you've used ML or Haskell?), not theoretical background. You should review the literature.