5 ms·
It seems like every 2 months I feel the burn of JS not having more standard primitive types and choices for numbers. I get this urge to learn Rust or Swift or G
by rhacker 6y ago
It seems like every 2 months I feel the burn of JS not having more standard primitive types and choices for numbers. I get this urge to learn Rust or Swift or Go which lasts about 15 minutes... until I realize how tied up I am with JS.
But I do think one day (might take a while) JS will no longer be the obvious choice for front-end browser development.
- tachyonbeam 6y agoAre you saying you'd like to have specific int32, int64, float32, float64 types?
- jjuhl 6y agoStrong typing and static typing - yes please.
- afiori 6y agoIn terms of adding types to deeply dynamic languages I think Julia had the best approach: sub-typing and union types. It has the advantage that it is possible to give a reasonable type to most functions without a rewrite (even if the types would be terribly long to accommodate the weak underlying type system)
- rhacker 6y agoYes this specifically.
- kevincox 6y agoWith WebAssembly that day is nearing. However it is certainly many years out.
- jayd16 6y agoYou could split the difference and go C# or Java and use one of their web stacks.
- qball 6y ago>But I do think one day (might take a while) JS will no longer be the obvious choice for front-end browser development. I think that day might be sooner than anyone thinks- Chromium is dominant enough now that their including Dart as a first-class language (or more likely, a successor to Dart) will likely be a viable strategy soon. Of course, the wildcard is Apple, but ultimately Dart can compile down to JS- being able to write in a far superior language that natively runs on 80% of the market and transpiles to the rest is suddenly much more of a winning proposition.
- shrewduser 6y agoI feel like kotlin is a much better language than dart, has many more use cases and compiles down to javascript also.
- elevenoh 6y agoDart is weak for functional programming / functional way of thinking. Right there, dart lang loses me as a potential user.
- sroussey 6y agoIf you want that, you can start with TypeScript and name your number types. Doesn’t do anything real at the moment, but subsections of code can then be compiled as assemblyscript to wasm.
- robpalmer 6y agoWhat other numeric types would you like to see? In addition to the existing doubles, ES2020 added support for signed integers.
- FullyFunctional 6y agoFunny, I have a small JavaScript app I have abandoned because I find developing JS so awful. Now that I have ramped up in Rust I am very tempted to rewrite it as Rust has first-class WASM support. Unfortunately I'd still need JavaScript for the UI bits. IMO: Rust isn't the easiest language to learn, but the investment pays off handsomely and the ecosystem is just wonderful. EDIT: I meant "to learn" which completely changes the statement :)
- kortex 6y agoI dunno how you folks do it, but I admire anyone that can stick with JS. It's just so...bonkers, every aspect about it, from the obvious "wat" moments, lack of integers, to the mental overhead of libs, modules, frameworks, templates, and packing. But I'm glad I have coworkers that grok it. I like trying new languages and have played with dozens, and JS and Prolog are the only languages that have made me actually scream. You should definitely try to branch out. At the very least it gives you new ways of thinking about things. Go or dart is probably the best for "JS killer" in terms of maturity, tooling, and targeting the front end, followed by haxe, swift and/or rust (they may be better even, but frankly I'm not as familiar with them).
- mantap 6y agoHonestly modern JS has far fewer "wat" moments than most languages, modern javascript is incredibly well designed. And JavaScript does have integers now. Nowadays it feels like the opposite, the committee takes so long to dot the i's and cross the t's that features take multiple years to make it through the approval process be ready to use (I'm looking at you, optional chaining).
- hajile 6y agoJS supports bools (Boolean) floats (Number) ints (x|0 for i31 and BigInt) arrays (Array, and 11-ish variants of TypedArray) linked lists (Array) sets (Set and WeakSet) maps (Map and WeakMap) structs (Object) genSym (Symbol) functions (Function) strings (String) What are they missing that you are dying to have?