News for hackers. Stuff that matters.
Re:Moving from TypeScript to Rust / WebAssembly by aphextron on Thursday July 09, 2020 @01:18AM (#23777156)
This really nails why languages like PHP and Ruby have won out over static typed, compiled ones for application level web development. The web is a massive collection of disjointed, loosely coupled APIs that all (just barely) interoperate to provide a massive array of functionality. Languages that tend to work well with it are those that are highly flexible around the corner cases of these technologies, and allow you to quickly iterate through the process of gluing them together.
Re:Moving from TypeScript to Rust / WebAssembly by jes5199 on Thursday July 09, 2020 @03:52AM (#23777936)
I’ve worked on several large Ruby codebases, and the thing is, the same qualities that make it easy to get a Ruby project up and working quickly make it a complete nightmare to maintain later. Its expressiveness and malleability mean that you can never really be sure that you understand how code is being used, and the complexity that emerges from a few years of that is incredibly overwhelming. Nowadays I would much rather slog through ten times as much Java boilerplate, because later I’d expect that I could still refactor code without fearing that the whole thing would collapse around me
Re:Moving from TypeScript to Rust / WebAssembly by tluyben2 on Thursday July 09, 2020 @04:42AM (#23778183)
Exactly; I guess a lot of people just work on projects/jobs and then move on. Once you need to go back to systems you forgot about (things you wrote 5-10-15-20+ years ago), Ruby (in your example and indeed my experience) is a nightmare on speed. The (strange to me) idea that people have that their code won't be around that long, hits me in the face every time a client asks me to 'connect to something made by someone some time ago'; I go check it and it's almost always something php/RoR/(and lately node) built by someone that left years ago and no-one touched it since because it works. When you actually do touch it, ofcourse, it is completely out of date, nothing current works and because of the flexibility of these languages and systems things change way too fast (really unneeded API breaks in packages is something crazy to me; coming from Java, I expect people to keep things backward compatible, but nope; just toss it out!) (especially node npm and least of all PHP which is actually a joy to work with in this kind of spelonking as it is remarkably stable including it's (older) libraries) (and no, not everyone uses a framework with php 'nowadays'; I run into many PHP projects a few years old that are just plain php, more so than frameworks used and that actually does make it easier to jump as plain php still works from a decade ago after update). And then when you have it running on your laptop, it usually is full of these 'corner cases' (lazy programmer input/output handling I would call it) which don't age well (and often hides bugs).

On the other hand, running into Java or C# projects is hardly ever an issue; it's a lot of boiler plate (many (request/response/dto etc) models/entities and layers), but it's readable immediately and if it still runs, it means that all data is validated and I can trust it.

Re:Moving from TypeScript to Rust / WebAssembly by The_rationalist on Thursday July 09, 2020 @06:18AM (#23778637)
The dilemma: boilerplate vs dynamic languages is a thing of the past. Kotlin make code even clearer than in java while being the sexiest syntax out there. It's 100% compatible with your Java code so you can incrementally migrate starting now!
Re:Moving from TypeScript to Rust / WebAssembly by zaphar on Thursday July 09, 2020 @09:05AM (#23779731)
The dilemma was always a false choice. You don't need kotlin to get rid of your boilerplate. Java is just a capable of being concise as any other language. Java's verbosity is a cultural artifact not a technical one.
Re:Moving from TypeScript to Rust / WebAssembly by The_rationalist on Thursday July 09, 2020 @11:00AM (#23781006)
No it is not as capable. The cultural verbosity is only a subset of the verbosity in java. The cultural one is great as those long API names allows for standardized and maximal clarity. The one induced by language syntax is accidental.

https://www.mediaan.com/mediaan-blog/kotlin-vs-java Things like state of the art type inference, data classes and lambda syntax, no semi colon and ton of other things allow for reduced syntactic noise.

Re:Moving from TypeScript to Rust / WebAssembly by ed25519FUUU on Thursday July 09, 2020 @10:36AM (#23780732)
Don’t get me wrong. I use java every day and quite enjoy it, but when I compare it to writing in Go or Kotlin, java does sometimes feel a little like meta programming. Especially if it’s a spring app, which is quite common.
Re:Moving from TypeScript to Rust / WebAssembly by eitland on Friday July 10, 2020 @03:25AM (#23789049)
This is obviously a matter of taste but I enjoy Java more when I stay away from Spring.
Re:Moving from TypeScript to Rust / WebAssembly by mumblemumble on Thursday July 09, 2020 @01:56PM (#23782991)
So, technically, you can get rid of a lot of the more egregious clutter with things like Project Lombok.

But I'd argue that, if you need to lean on compiler plugins to do it, it's sort of a rhetorical Pyrrhic victory.

Re:Moving from TypeScript to Rust / WebAssembly by pjmlp on Friday July 10, 2020 @01:48AM (#23788550)
And I would argue that adopting guest languages, alongside the extra complexity that they bring on board regarding extra IDE plugins, more layers to debug (has to pretend to be Java to the JVM), FFI issues (calling coroutines from Java), and creating their own library eco-system is not worth the trouble, beyond some short term feel good.

As long as the platform exists, its main language is the one holding the keys.

Re:Moving from TypeScript to Rust / WebAssembly by runawaybottle on Sunday July 12, 2020 @05:30PM (#23814922)
Can you describe this a little more. How did the verbosity enter the culture?
Re:Moving from TypeScript to Rust / WebAssembly by pjmlp on Friday July 10, 2020 @01:40AM (#23788501)
Kotlin has sealed its fate turning into Android's main language.

On the JVM its novelty will fade out while Java adopts whatever features might be relevant to the millions of Java developers out there, just like it happened with all other that came before.

And I remember the days back when Groovy was supposed to be the scripting language for JEE, and Spring was going full speed with it as Java alternative, and we even got strongly typed variant.

Re:Moving from TypeScript to Rust / WebAssembly by mumblemumble on Thursday July 09, 2020 @11:57AM (#23781605)
I've discovered in large, long-lived Java codebases that it's common to Greenspun expressiveness and malleability back into the language through heavy reliance on things like Spring, stringly typed mechanisms, and dynamic code generation.

The impact on maintainability is about what you'd expect. Maybe, on an abstract level, the software isn't as complex as what you can do in Ruby, but the verbosity of the language brings its own maintenance challenges. I can't speak to Ruby specifically, but, in practice, I haven't found that I'm all that much more afraid to change things in a large Python codebase than a large Java one.

I'm now coming to think that the real challenge is dynamicism in general, regardless of whether it's built into the language or implemented as a library solution. So, if Java has an advantage here, it's simply that it tends to discourage people from overdoing it by making it awkward to do.

Re:Moving from TypeScript to Rust / WebAssembly by milesvp on Thursday July 09, 2020 @12:26PM (#23781886)
What I find interesting about dynamism, is that every templating library I’ve ever used has a tendency to become php over time. Even templating libs in php! It’s fascinating to watch, since each new feature really makes sense because certain logic is trivial in the template, that would be way more complicated elsewhere, and so the template lib has pressure to add little things. Next thing you know the complexity and feature set of the lib is it’s own beast to deal with.
Re:Moving from TypeScript to Rust / WebAssembly by DevoidSimo on Thursday July 09, 2020 @04:55AM (#23778247)
Agree here, admittedly I have no prior Ruby experience, but I've inherited a code base in Rails. There is so much magic that goes on implicitly. I end up jumping around everywhere to see why something unexpected is happening.
Re:Moving from TypeScript to Rust / WebAssembly by thepratt on Thursday July 09, 2020 @05:01AM (#23778272)
Have you used sorbet on these codebases? I'd be curious if there'd be a benefit here in terms of maintainability.
Re:Moving from TypeScript to Rust / WebAssembly by zrail on Thursday July 09, 2020 @06:33AM (#23778705)
Sorbet is the only way I can function in anything larger than a 10 line script these days. I’ve started adding it to personal projects because it makes revisiting them later so much easier.
Re:Moving from TypeScript to Rust / WebAssembly by square_usual on Thursday July 09, 2020 @08:28AM (#23779437)
Without the LSP implementation out in the open, though, sorbet is just a type checker. It's not made much for sense for me to start integrating it into my personal projects just yet, since I only get the benefits when I run tc manually. Once Stripe opens up the LSP, however, I can see it gaining widespread adoption.
Re:Moving from TypeScript to Rust / WebAssembly by zrail on Thursday July 09, 2020 @07:05PM (#23786303)
I haven’t tried the open source release lately but it looks like master has the lsp option.
Re:Moving from TypeScript to Rust / WebAssembly by jes5199 on Thursday July 09, 2020 @03:22PM (#23784006)
sorbet is relatively new and I've been avoiding ruby for the last two years
Re:Moving from TypeScript to Rust / WebAssembly by wahern on Thursday July 09, 2020 @04:59PM (#23785163)
> Nowadays I would much rather slog through ten times as much Java boilerplate, because later I’d expect that I could still refactor code without fearing that the whole thing would collapse around me

Sure, but if you don't reach market fast enough you'll have no reason to slog through anything, period. Can you imagine writing something like Facebook using Rust? It's an almost ludicrous proposition.

Static typing requires that you know what you're building at a relatively fine-grained level--how the pieces will fit together at the source code level, at least roughly. No amount of automated refactoring could ever match the flexibility of dynamic typing when you're just trying to bang out features, let alone explore the feature space, which almost by definition is what any novel solution is doing--exploring. That's why I love using embedded scripting, particularly Lua. You can gradually move components outside the dynamic environment as their place in the architecture becomes fixed and well understood.[1] So-called gradual typing doesn't really permit the same kind of flexibility because it's not the static typing, per se, that burdens development, but rather that static typing has the effect of forcing a more rigid hierarchy of higher-order abstractions and interface boundaries. What you want is the ability to slowly solidify the architecture from the outside to the inside, not the inside to the outside.

Microservices is another way to address the problem, at least in theory, but in practice doesn't actually directly resolve the real dilemmas. At best it just multiplies the number of environments in which you're faced with the problem, which can both help and hurt.

[1] Statically typed scripting languages seem rather pointless to me, and more a reflection of a fleeting fascination with REPL.

Re:Moving from TypeScript to Rust / WebAssembly by caffeine on Friday July 10, 2020 @08:19AM (#23790741)
I think if you were starting today, you would build the app as a set of backend APIs connected to an array of front ends (apps, mobile web, desktop web, 3rd party, etc).

Building some or all of those backend APIs in Rust from day 1 would not be crazy, or less productive than any other language.

I think differences in proficiency drive bigger differences in productivity than inherent language differences.

So if you were starting today to build Facebook, using a language you are already effective with would matter more than which language you use (there are plenty of people out there for whom that could be Rust, or Haskell, or Ruby, or PHP, etc).

Re:Moving from TypeScript to Rust / WebAssembly by iopq on Saturday July 18, 2020 @03:49AM (#23879798)
After working with a 300,000 LoC code base of PHP I would gladly rewrite Facebook in Rust. It allows effortless atomic commits. When I build something I make an MVP of a first version, refactor, make an MVP of the next version, refactor, and so on.

Rust lets me make sure my code still works through refactors and code changes. With PHP I could easily break something that would only cause an error when that code actually runs. That's right, there is no sanity check at all until the parser reads that code.

Re:Moving from TypeScript to Rust / WebAssembly by steveklabnik on Thursday July 09, 2020 @06:45PM (#23786136)
Facebook uses a bunch of a Rust, incidentally. They also use a lot of statically typed languages, and have made some of their own, even.
Re:Moving from TypeScript to Rust / WebAssembly by victor106 on Thursday July 09, 2020 @01:45PM (#23782863)
Exactly this.

I was involved in developing large PHP and Rubby codebases and its so hard to maintain.

These days I just use SpringBoot. It strikes a good balance between providing speed to market (PHP/Ruby), maintainability and performance (the next version should support GraalVM). Cant complaint so far.

Re:Moving from TypeScript to Rust / WebAssembly by rubber_duck on Thursday July 09, 2020 @05:08AM (#23778303)
Won ? Ruby fell off a cliff once it got to a point where people had to maintain that shit in production - I'm currently working on a large mature RoR codebase and I'm switching jobs ASAP because it's incredibly painful to work with and feels like a dead end career wise - and I like the gig otherwise - good product and a decent team - but the technology is draining so much of my life energy on nonsense it's ridiculous. And the language is built for unmaintainability - standard functions being abbreviated to a single letter, 2 or 3 aliases for a single standard function (map/collect and such), Rails overriding the conventions of the language (! postfix). And then there's the architectural retardation of fat models, fat controllers and using mixins ("concerns") completely break encapsulation - all actively killing code reuse-

PHP has long been a meme and is mostly legacy stuff or bottom tier work.

Dynamic languages are adding static optional static typing because the value provided by tooling as the projects scales is undeniable.

It took ES6/TypeScript to drag JS out of the dump that it was with every library adding its own take on a class system - the maintainability jump from ES5 to TS is incomparable for anything larger than 1k LOC

Re:Moving from TypeScript to Rust / WebAssembly by wwright on Thursday July 09, 2020 @06:56AM (#23778832)
I say this a lot, but if you are this irritated by Rails, then you ought to see the 20+ year old legacy C/C++ some of us get to work with ;)
Re:Moving from TypeScript to Rust / WebAssembly by rubber_duck on Thursday July 09, 2020 @09:45AM (#23780099)
I started on C++ back in VS6 days and I wrote tons of it when I was in to game dev and graphics programming - but I would not want to work on those systems and kinds of problems when I can get paid the same to work on higher level stuff - the tooling quality and slow iteration cycle when I'm really stuck on something leads to a lot of stress - I just want low stress dev environment where I focus on solving problems I'm being paid to solve - not problems created by the tools and then having to explain stakeholders why something seemingly simple takes 3x of the estimate. I like environments where I'm confident in my estimates - C# proved to be good in this regard simply because the tooling is there even when I hit a wall and it has a relatively consistent uniformity that makes it easier to navigate unknown territory.
Re:Moving from TypeScript to Rust / WebAssembly by cmrdporcupine on Friday July 10, 2020 @09:50AM (#23791437)
Funny, after 10 years of Java and other high level languages I was very happy to go work on C++ at a lower level and have been pushing myself lower down the stack as I go.

C++ these days is a far more pleasant beast than the VS6 days, the tooling is pretty good and the language can be tamed into a pretty elegant beast with the right coding standards and discipline.

Re:Moving from TypeScript to Rust / WebAssembly by bigredhdl on Thursday July 09, 2020 @02:33PM (#23783450)
I agree. My team is just more productive in C#, so we just stay there as much as possible. As you say, the ability to work on just solving the actual problem is very under valued.
Re:Moving from TypeScript to Rust / WebAssembly by cmrdporcupine on Thursday July 09, 2020 @08:58AM (#23779675)
This is one nice thing about working at Google. We have C++ codebases that are 20 years old, but you'd never be able to tell because they are still continuously worked on and even if not there's a team of people at Google who constantly run company-wide refactorings and the like to modernize things.
Re:Moving from TypeScript to Rust / WebAssembly by gen220 on Thursday July 09, 2020 @09:12AM (#23779771)
This is, IMO, one of the most underrated aspects of the monorepo, that has such a valuable impact over time.

It only takes a handful of extremely passionate engineers (and I really mean a handful, like less that 2% of engineers in an org) to raise the quality-floor of the entire codebase.

Re:Moving from TypeScript to Rust / WebAssembly by lifeisstillgood on Friday July 10, 2020 @05:52AM (#23789767)
For sanity, sustainability and fairness I would rather that read

It only takes a handful of extremely passionate engineers > It only takes a handful of paid engineers, full time assigned to the task

Re:Moving from TypeScript to Rust / WebAssembly by gen220 on Friday July 10, 2020 @10:45AM (#23791946)
Anecdotally (I don't work at Google, and this might not apply there because it's such a large company): At the monorepo companies I've worked at, of the 2% passionate I mentioned, maybe half have naturally gravitated towards working FT on the infra teams, the other half make very occasional but astronomical contributions, while working full-time on an actual product.

What I mean to say is that with a monorepo, you leave the door open to essentially passion-driven contributions made by the other half of that 2%. In non-monorepo environments, the barrier to uniform adoption is too high for someone that isn't full-time assigned to the task to justify.

Some people are genuinely passionate about this stuff, and want to take on the task of migrating the entire code base, because it's a fun challenge and it'll improve their day-to-day work every day for the remainder of their employment. They're very rare, but they do exist, and with a monorepo those people are better-equipped to drag the company forward.

Re:Moving from TypeScript to Rust / WebAssembly by lifeisstillgood on Friday July 10, 2020 @05:03PM (#23796428)
I don't get this - changing the code is not the problem - this is a political / marketing issue.

I have some news - passion is not enough, and there are more than 2% of people working on things they are passionate about - it only 2% get lucky.

I can think of a few instances in my recent career at large monorepo company where I have built something on the scale of "passionate, could improve our working lives"

One died because ... well I gave up, two are used locally by my team and those I could persuade, whilst other solutions built by others for the same fix have gone on to be blessed officially, (ie replaced by grassroots competition) and one was replaced by a fully mandated and funded project that spotted the need and just steamrollered over all the local fixes.

One is still outstanding and I think well worth pushing still.

But I don't dream of the big win where suddenly the Board says "why, without your glasses Miss Moneypenny you look ravishing".

I get paid, I work, and I try and make the world a bit better where I can. I am passionate about it. But i don't write blog posts about how passionate I am.

Maybe I should :-)

Re:Moving from TypeScript to Rust / WebAssembly by randall on Thursday July 09, 2020 @09:30AM (#23779936)
Ya, fb feels the same way fwiw. I'm very sold on the benefits of monorepos now.
Re:Moving from TypeScript to Rust / WebAssembly by mmargerum on Thursday July 09, 2020 @10:07AM (#23780372)
I've got a large codebase i've been maintaining since 1999 that i've continued to evolve and is still in use today . I've been able to steadily improve it without breaking much. IDK maybe its being > 50 but I can appreciate less "dynamic" environments. I do we dev in vue with a go back end but I know the vue part is going to be a rewrite in 5 years. Who wants to keep doing that shit? not this 52 year old guy.
Re:Moving from TypeScript to Rust / WebAssembly by cmrdporcupine on Thursday July 09, 2020 @11:25AM (#23781267)
Modern refactoring and static analysis tools really make it far easier to keep old code bases up to date.

As a hobby thing I'm taking an almost 30 year code base written in C and reworking it into C++17. I've become somehow somewhat adept at this transformation over the years :-)

Re:Moving from TypeScript to Rust / WebAssembly by pjmlp on Thursday July 09, 2020 @01:42PM (#23782838)
Yeah, the problem is that the large majority of the world isn't Google, software isn't their main business, and their codebases are maintained by a continuous rotation of external contractors that are paid by the tickets that they get to implement.
Re:Moving from TypeScript to Rust / WebAssembly by cmrdporcupine on Friday July 10, 2020 @09:48AM (#23791423)
Yep, and don't get me wrong. Stray out of the monorepo and into the wilds of various git hosted code bases at Google and you'll find code rotting in the fields, maintained to a far lower standard (IMHO).
Re:Moving from TypeScript to Rust / WebAssembly by angrygoat on Thursday July 09, 2020 @08:46AM (#23779568)
I'll see your legacy C/C++ and raise you legacy Fortran 77 :)
Re:Moving from TypeScript to Rust / WebAssembly by wwright on Thursday July 09, 2020 @09:37AM (#23780006)
We needn't fill the young Rubyist's head with nightmares that deep, friend :)
Re:Moving from TypeScript to Rust / WebAssembly by Dowwie on Thursday July 09, 2020 @09:10AM (#23779764)
I think you would really appreciate Rust for backend web dev. Quite a few people who were once upon a time hardcore rubyists gravitated to Rust and became some of its greatest contributors: Steve K., Sean G., Carl L., Florian G., and many more.
Re:Moving from TypeScript to Rust / WebAssembly by rubber_duck on Thursday July 09, 2020 @09:59AM (#23780289)
I like Rust a lot - especially since I have a C++ background - unfortunately I don't see any opportunities to move to it ATM, but I haven't really tried hard enough - maybe I'll take a month off after my current project to write something substantial in it and try to find a Rust gig.
Re:Moving from TypeScript to Rust / WebAssembly by kevinyew on Thursday July 09, 2020 @07:41AM (#23779096)
PHP is definitely not a meme, it's got a ton of actively developed frameworks, PHP 7 was a huge step forward for the language and PHP 8 is shaping up to be as well.

It's been used at every workplace I've been at, sometimes well, sometimes not so well, just like any language. No idea what the point of blanket statements like this is.

Re:Moving from TypeScript to Rust / WebAssembly by ampersandy on Thursday July 09, 2020 @10:27AM (#23780609)
Especially when said statements are just wrong. Anecdotal evidence from individual companies does not allow you to make representative statements about the entire internet...

https://w3techs.com/technologies/details/pl-php claims ~79% of websites whose backend is known use PHP.

https://w3techs.com/technologies/details/pl-ruby shows Ruby has grown from 2.5-3.5% over the last year.

Re:Moving from TypeScript to Rust / WebAssembly by jmuguy on Thursday July 09, 2020 @07:42AM (#23779101)
Which standard function in Ruby is a single letter?
Re:Moving from TypeScript to Rust / WebAssembly by rubber_duck on Thursday July 09, 2020 @07:57AM (#23779202)
b, to_s, to_i, to_a, to_c, to_h, to_r, etc.

Should have said methods but you get what I mean. And I've encountered ambiguous and pointless abbreviations all over the place.

Re:Moving from TypeScript to Rust / WebAssembly by colmvp on Thursday July 09, 2020 @08:33AM (#23779472)
It's weird, when I was I younger I used to love shortform syntax like that as well as removing unnecessary punctuation

But now that I'm older, I appreciate things being more descriptive and orderly, including strict use of semicolons, functions that say what they are doing (e.g. to_string), or being explicit about converting (e.g. static_cast<type>)

I think it's because I find trying to make everything as succinct as possible ends up trying to be too clever.

Re:Moving from TypeScript to Rust / WebAssembly by zaphar on Thursday July 09, 2020 @09:02AM (#23779708)
When I was younger I tended to write more code than I read. As I got older I transitioned to reading more code than I wrote. This correlated with a desire toward a preference for code that self documents as I progressed.
Re:Moving from TypeScript to Rust / WebAssembly by SAI_Peregrinus on Thursday July 09, 2020 @09:12AM (#23779779)
I type fast enough that somewhat longer names don't hurt. Also tab completion has existed both in IDEs and in shells for many years now. But just like very nearly everyone else I fall into the "7 ± 2 items in working memory at once" capability range. Having to remember what a command/function/syntax element does instead of reading a word that says what it does takes away from that working memory.

Long-term memory is similar, while it's not bounded in the same way it takes time and effort to develop. I'd rather type `git new-branch` than have to remember `git checkout -b` and I certainly don't alias it to `git nb` or something: I can type `git n<TAB>` and let that complete it.

Re:Moving from TypeScript to Rust / WebAssembly by peterholcomb on Thursday July 09, 2020 @09:09AM (#23779752)
Well said. "Clean Code" goes into this a lot and it helped me realize why I was starting to become more and more bothered by looking back at the short variable names I wrote years ago on my projects.
Re:Moving from TypeScript to Rust / WebAssembly by wing-_-nuts on Thursday July 09, 2020 @12:38PM (#23782009)
When I was first learning java I loathed the verbosity, but I was coding everything in vi. Now days with good ides, I don't mind java's verbosity or even the boiler plate.

I find myself more annoyed by dynamic languages, because the tooling just isn't at the same level. All sorts of 'hints' that I rely on in java simply aren't there in other languages, and the ide throws up it's hands and is like '...? I guess this is right? Godspeed sir', and I wind up having to go lookup documentation rather than ctrl clicking into underlying functions and code. It's really annoying, and it's made me be more appreciative of staticly typed languages.

Re:Moving from TypeScript to Rust / WebAssembly by jmuguy on Thursday July 09, 2020 @09:06AM (#23779735)
Interesting, I’d never seen or used .b or .p that someone else mentioned. I agree those definitely should not be a part of the standard library. Not sure about to_i etc. we use those pretty often and it’s never really been an issue.
Re:Moving from TypeScript to Rust / WebAssembly by andrenth on Thursday July 09, 2020 @08:18AM (#23779355)
p
Re:Moving from TypeScript to Rust / WebAssembly by thecreamedcorn on Thursday July 09, 2020 @12:48PM (#23782123)
I think you took the phrase too literally. I'm assuming by won they didn't mean that Ruby and PHP will dominate the web landscape for eternity. I'll just point out that dynamic programming languages have for most of the webs history been the primary tool for developers.
Re:Moving from TypeScript to Rust / WebAssembly by Kiro on Thursday July 09, 2020 @08:37AM (#23779505)
The meme here is that your comment reads like a parody of an outraged junior programmer at their Dunning–Kruger peak.
Re:Moving from TypeScript to Rust / WebAssembly by blub on Thursday July 09, 2020 @02:06AM (#23777394)
They've "won" so far because static types languages were cumbersome and unpleasant to use, but this is changing and dynamic languages are learning some type tricks too.

The issue here is with Rust: its strengths are mostly irrelevant for the web and its weaknesses (particularly slow development compared to the competition because of having to pacify the type checker) are really important.

Op is painstakingly beating around the bush, but what they're getting at is that Rust + webdev = mismatch.

Re:Moving from TypeScript to Rust / WebAssembly by jfkebwjsbx on Thursday July 09, 2020 @03:00AM (#23777683)
For a lot of "usual" webdev, any reasonably modern language will do. Even modern JavaScript will be fine. Something like C# would have been way better, though, but we cannot change that now.

However... software development has become a mess of slow technologies and abstractions one on top of the other.

Some people are working routinely in a text editor that is behind three operating systems: the VM/hypervisor, the usual operating system (Windows/macOS/Linux) and then a browser instance (which is like a operating system now). Then add all the drivers, libraries, frameworks etc. that go in-between.

While I don't like that WebAssembly is yet another abstraction, at least it is a chance for a resurgence of system programming languages and to proper software engineering...

Re:Moving from TypeScript to Rust / WebAssembly by tracker1 on Thursday July 09, 2020 @06:29AM (#23778690)
Why can't you use C#? .Net Core (upcoming .Net 5) are pretty decent to work with. I'd still rather use node for the most part though.

I have been playing with Rust, but not sure about how good an idea it is for the front end yet though.

Re:Moving from TypeScript to Rust / WebAssembly by jfkebwjsbx on Thursday July 09, 2020 @08:13AM (#23779320)
Well, you can compile the .NET runtime into Wasm, send it to the client and run C# on top of it, but then you are adding yet another layer.
Re:Moving from TypeScript to Rust / WebAssembly by tracker1 on Saturday July 11, 2020 @01:44PM (#23804055)
I didn't have the impression the discussion was a web context. In which case if lean straight js/react or rust/yew
Re:Moving from TypeScript to Rust / WebAssembly by swebs on Thursday July 09, 2020 @08:20AM (#23779370)
Pretty sure the parent comment was talking about client side.
Re:Moving from TypeScript to Rust / WebAssembly by LandR on Thursday July 09, 2020 @01:41PM (#23782821)
You can use C# on the front end now with Blazor. It's pretty new though so I don't know how good it is yet.
Re:Moving from TypeScript to Rust / WebAssembly by staticassertion on Thursday July 09, 2020 @02:23AM (#23777490)
I don't totally agree about its strengths not being relevant. Memory safety is an extremely low bar that the web has generally managed to meet, but Rust has a lot of value elsewhere. The author talks about significant performance improvements, which would be very welcome on many sites, as well as improved error handling and data validation patterns.
Re:Moving from TypeScript to Rust / WebAssembly by blub on Thursday July 09, 2020 @02:35AM (#23777559)
Most things thank goodness are not SPAs, nor do they have to be.

The problem here is the concept of SPA itself - it's a complete hack which is plastered over with various tricks to make it halfway usable. This has been going on for years now.

Websites on the other hand are slow because of the tracking and the ads which load tons of JS. Remove that and the web will be blazing fast.

Re:Moving from TypeScript to Rust / WebAssembly by heavyset_go on Thursday July 09, 2020 @05:19AM (#23778360)
> Remove that and the web will be blazing fast.

With sufficient ad blocking and JS white listing, I can attest to this.

After removing ads and analytics, sites that rely on JavaScript to render significant amounts of content are the slowest.

Re:Moving from TypeScript to Rust / WebAssembly by XCSme on Thursday July 09, 2020 @10:35AM (#23780726)
If you have A LOT of content (eg. a table with 10000 rows containing rich data) it will be faster to use a JS virtualized list than to just have all those 100k+ DOM elements computed at once.
Re:Moving from TypeScript to Rust / WebAssembly by ashkante on Thursday July 09, 2020 @07:14AM (#23778924)
I am currently writing a hobby project in Rust with Rocket and Diesel. I could bang out a working prototype very quickly with either Python or something like ASP.NET, but I picked Rust because I want to get better at it.

Many of the things you say are true - Rust libraries in general need some love and polish before they can be beginner-friendly, but some are getting there. The difference between Diesel and Rocket, for example, is quite stark. The former has only the barest minimum 'examples' and 'guide', if they may be called that, and I feel like I'm expected to read and understand its source code to become really proficient with it. It takes a lot of experimenting and trial+error to do anything beyond the basics. Rocket, on the other hand, has a very comprehensive guide with useful examples and, so far, has been enjoyable to work.

That said, there are still a lot of "convenience" features missing. My current notable example is forms. As I'm doing it (I haven't looked into any addons to Rocket for this), I have to write out the HTML for the form myself, along with any Javascript I might require for validation, etc, then write the server-side methods for GET/POST, making sure to maintain the state myself. In this regard, something like Django's effortless ease to get a form on screen and store its data into a database really showcases where Rust (Rocket) still has a long way to go.

Hopefully, with more people using it, the tools and libraries will improve and mature, particularly the documentation.

When all is said and done, I enjoy "slogging" through Rust a lot more than I did working with Django, even with the slower progress. Something about this language really speaks to me.

Re:Moving from TypeScript to Rust / WebAssembly by cageface on Thursday July 09, 2020 @02:13AM (#23777438)
Exactly. The frameworks aren't there yet but I think Typescript is pretty much ideal for web dev. We're still using dynamic languages for web dev for mostly legacy reasons now.
Re:Moving from TypeScript to Rust / WebAssembly by cies on Thursday July 09, 2020 @03:09AM (#23777721)
Not sure if "ideal" is a good choice of word here. We dont know what's still coming. It surely has some flaws (many inherited from JS). There is stuff like ReasonML/Elm/PureScript that seems more ideal to me from a pure language (not eco sys, job/talent market, etc) perspective.
Re:Moving from TypeScript to Rust / WebAssembly by cageface on Thursday July 09, 2020 @03:18AM (#23777759)
Yeah sure there are many better languages than TS in an absolute sense but TS is the only one I see with the momentum to displace the current incumbents.
Re:Moving from TypeScript to Rust / WebAssembly by te_chris on Thursday July 09, 2020 @07:00AM (#23778851)
It's still a single threaded run time. There's one platform that's ideal for web, BEAM, but unfortunately it doesn't have a strongly typed language. Elixir and Erlang are both great languages though.
Re:Moving from TypeScript to Rust / WebAssembly by Multicomp on Thursday July 09, 2020 @08:16AM (#23779339)
I can't speak to whether or not the BEAM is ideal for the web, but I will say I've been watching the Gleam project very closely because having static typing with the BEAM is a dream of mine.
Re:Moving from TypeScript to Rust / WebAssembly by collyw on Thursday July 09, 2020 @03:57AM (#23777947)
I think they have "won" in certain domains. Java and C are still widely used in loads of places, though less so in web dev.
Re:Moving from TypeScript to Rust / WebAssembly by masklinn on Thursday July 09, 2020 @05:49AM (#23778519)
> This really nails why languages like PHP and Ruby have won out over static typed

It really doesn't.

Languages like PHP and Ruby "have won out" over statically typed languages because the representatives of statically typed languages at the time were Java and C++, both of which were bad (they still are, but they were): verbose, difficult (and verbose) to leverage for type-safety, missing a bunch of tremendously useful pieces (type-safe enums to say nothing of full-blown sum types), nulls galore, …

As a result, the gain in expressiveness and terseness (even without trying to code-golf) of dynamically typed languages was huge, the loss in type-safety was very limited given the choice was "avoid leveraging the type system" or "write reams of code because the language is shit", and the fast increase in compute performances more than compensated for the language's loss in efficiency.

And that's before talking about the horror show that Java's web frameworks ecosystem was circa 2006.

> Languages that tend to work well with it are those that are highly flexible around the corner cases of these technologies, and allow you to quickly iterate through the process of gluing them together.

That's really complete hogwash outside of the client, which isn't what we're talking about here since neither php nor ruby run there. On the server you have clear interfaces between "inside" and "outside", and there's no inflexibility to properly taking care of cleaning up your crap at the edges. Quite the opposite, really.

Re:Moving from TypeScript to Rust / WebAssembly by treis on Thursday July 09, 2020 @11:02AM (#23781028)
I think this is spot on. IMHO, everyone that uses Rails knows it's flawed. The problem is that there's not a better option out there that:

(1) Is "batteries included"

(2) Has the gem/engine ecosystem where basically every problem is already solved.

(3) Expressive code like has_many :things

If we could get those things + static typing + performance everyone would switch. But that doesn't exist.

Re:Moving from TypeScript to Rust / WebAssembly by ryanianian on Thursday July 09, 2020 @12:06PM (#23781685)
That alternative in 2020 is Python 3.7+ with typing annotations.

Python is very "batteries included," and there is a large set of exisitng packages for most things. One can monkey-patch things and invent cute syntax, but most python is rarely hard to reason about what's actually going on.

It's easy to bag on parts of python (eg some syntax and terrible distribution story), but I feel much less crazy (and suspicious of every punctuation mark) when working on a modern python app than when working on a modern ruby app, especially in the presence of rails.

Re:Moving from TypeScript to Rust / WebAssembly by pjmlp on Thursday July 09, 2020 @01:52PM (#23782937)
.NET and Java have enough batteries, 20 years of libraries solving every problem, several expressive languages available, alongside AOT/JIT compilers.
Re:Moving from TypeScript to Rust / WebAssembly by treis on Thursday July 09, 2020 @02:08PM (#23783166)
.NET has the problem if being a MS product. It's only relatively recently that they've decided to be fully cross platform and open source. I'm not sure if it's all the way there yet, but it could be a viable option.

Java is fine as a programming language. Java as a web app more or less means Spring. And Spring means XML files and annotations which come with their own problems. Kind of an out of the pan and into the fire thing.

Re:Moving from TypeScript to Rust / WebAssembly by blandflakes on Friday July 10, 2020 @09:51AM (#23791443)
You can get away without using Spring and do quite fine, but there's definitely a risk that if you invest in the JVM ecosystem you'll get hired to work on Spring.

(alternatives like Vert.x, the less-annotation-heavy quarkus, etc).

For Java web dev I actually like Kotlin better - ktor is pretty nice.

Re:Moving from TypeScript to Rust / WebAssembly by pjmlp on Thursday July 09, 2020 @02:16PM (#23783280)
Plenty of companies don't care one second that it is a MS product, in fact it is a positive value on their eyes regarding product support and tooling.

First of all there is more to Java Web development than JEE and Spring, which in any case, other eco-systems don't have a mature answer for many of their deployment scenarios and cross system integrations.

XML is beautiful, there is yet a format that supports machine manipulation, IDE graphical tooling, comments, schema validation as XML.

Anyone that praises Rails will be right at home with XML and annotations magic.

Re:Moving from TypeScript to Rust / WebAssembly by cygx on Thursday July 09, 2020 @06:10AM (#23778599)
because the representatives of statically typed languages at the time were Java and C++

And Pascal, Ada, Haskell, Eiffel, Standard ML, ...

Re:Moving from TypeScript to Rust / WebAssembly by masklinn on Thursday July 09, 2020 @10:01AM (#23780313)
Operative concept: representative.

None of the language you mention had any sort of wide-spread visibility at that time, meaning they were not representative of the (overwhelming) majority experience with statically typed languages.

Re:Moving from TypeScript to Rust / WebAssembly by cygx on Thursday July 09, 2020 @03:12PM (#23783901)
As far as I'm aware, Pascal and Ada were still significant in the early 90s (ie when Python arrived). You're right that they where far less so when PHP entered the picture, but it's not as if they were dead (Borland Delphi and PHP 1.0 were realeased the same year).
Re:Moving from TypeScript to Rust / WebAssembly by masklinn on Friday July 10, 2020 @03:49AM (#23789156)
> Pascal and Ada were still significant in the early 90s (ie when Python arrived).

That is not the timeline we're talking about here. Dynamically typed languages started taking off at the turn of the millenium and really exploded in the second half of the aughts. Java didn't even exist in the early 90s.

Re:Moving from TypeScript to Rust / WebAssembly by cygx on Friday July 10, 2020 @06:21AM (#23789942)
But it's not as if the programming community collectively just forgot about these languages (and, as mentioned, Delphi and PHP are in fact contemporaries). The question remains, why did new dynamic languages rise, but already existing static languages decline? That requires an explanation.
Re:Moving from TypeScript to Rust / WebAssembly by zurn on Friday July 10, 2020 @08:04AM (#23790644)
Yep Delphi 1.0 was launched in the mid-90s and had a good run for some time after that.
Re:Moving from TypeScript to Rust / WebAssembly by mathw on Thursday July 09, 2020 @09:31AM (#23779941)
None of which really had mainstream visibility with the kind of people who actually made the decisions about what language your company would be using.
Re:Moving from TypeScript to Rust / WebAssembly by zurn on Thursday July 09, 2020 @06:25AM (#23778669)
Yep and on the dynamic side there were also Erlang, Python, Lua, Lisp, etc.
Re:Moving from TypeScript to Rust / WebAssembly by friendzis on Thursday July 09, 2020 @03:41AM (#23777879)
I think you get it backwards. Things are disjointed, loosely coupled because highly dynamic languages have won. The flexibility of dynamic languages, which can be great when working around dynamic corner cases, does not force developers into fixed, well-defined contracts keeping everything loose and disjoint.

PHP is highly to blame. PHP, being a scripting language, is easy to deploy and keeps chugging along at all costs. It may do something nonsensical, but it will try to chug along to completion without aborting. It creates a system where it is easy to write and deploy something that usually works.

Re:Moving from TypeScript to Rust / WebAssembly by davedx on Thursday July 09, 2020 @04:30AM (#23778119)
I completely disagree with this.

I work on a large C# platform that interops with a ton of vendor API's, the majority of which are also written in typed languages. The disjointed, loosely coupled nature of web systems is what causes problems. In particular, knowing what a "correct input" is to web systems is very difficult, where correct means:

1) Passes the API's immediate validation

2) Passes validation inside API's longer running processes

3) Passes business rules (it might be correct types, lengths etc, but fails anyway because of an incorrect combination of API calls)

Some of our vendors use Elixir, some use PHP, many use C# or Java. I really don't notice any significant difference between them on that account. The issues are all down to the complexity of the software and business requirements and that the whole thing is a giant distributed system.

Re:Moving from TypeScript to Rust / WebAssembly by Multicomp on Thursday July 09, 2020 @08:21AM (#23779374)
> knowing what a "correct input" is to web systems is very difficult

I cut my teeth programming an XML web service using soap and while I can't say that it was as drop-dead simple as a restful HTTP web api these days, between the wsdl and the uddi, it sure was convenient to be able to know as a client what methods were being exposed and what inputs they expected.

Sometimes I wish the w3c had not required XML for those web services ,so that we could do that with json plus whatever add-ons can make it have an enforceable schema like XML. WSDLs were underrated.

Re:Moving from TypeScript to Rust / WebAssembly by davedx on Thursday July 09, 2020 @10:42AM (#23780801)
I agree. It was nice being able to grab the WSDL from say, a .NET web service, and run your maven script on your Java app to generate the interop boilerplate and just start coding against a type-safe interface.
Re:Moving from TypeScript to Rust / WebAssembly by raxxorrax on Thursday July 09, 2020 @04:20AM (#23778062)
If have seen horrible javascript, but I have also seen horrible type-safe examples. It is always a compromise between errors, readability and productivity.

Attaching text in form of a script anywhere in the DOM can be abused, but it is also insanely practical. I don't think Javascript is too horrible. I think the whole toolchain to get minimized and bundled JS is. That is why I am wary of TypeScript. Yes, I see its benefits, but I don't like cross-compiling if I can just not do it.

Given, I am no web developer and my "projects" on the web are tiny. I completely understand someone who likes to take the increased effort to use TypeScript, especially if your project isn't just making a text blink. If it reaches a certain size, I would probaly look into it too.

Webassembly looks interesting, but will take some time to establish itself. There are also disadvantages to that, since it could reduce the openness of the web. All the tracking we are subjected to could only be inspected by network traffic instead of looking into the source.

Re:Moving from TypeScript to Rust / WebAssembly by irjustin on Thursday July 09, 2020 @03:53AM (#23777937)
I agree with both of you in that I don't think the direction of the origin really matters.

The problem is when dealing with other teams/products/api's it's a mess. Varying standards, varying strictness, corner cases everywhere. There are plenty of JAVA, ASP.Net APIs that are absolute nightmares to integrate with despite being strictly typed beginnings.

If you have a highly federated space, you control everything and thusly can do cool things like Rust, Lua, what have you. But, most engineers don't get such a luxury. Languages that can be rapidly morphed to accommodate all those situations achieve shipped solutions to business problems faster.

In the end, that makes money and that turns our world.

Regardless, here's the loosely related XKCD's Standards: https://xkcd.com/927/

Re:Moving from TypeScript to Rust / WebAssembly by CraigJPerry on Thursday July 09, 2020 @04:02AM (#23777972)
Applying a schema doesn’t fix an architecture problem.

Describing those fixed well defined contracts on top of the architurally absurd stack that is TCP/DNS/TLS/HTTP/Ajax/Dom/JS engine/Server side graphql/rpc/rest / database... doesnt by you anything but slower iteration speed and an unwieldy schema.

These components don’t have the same impedance, the same flavour to their design. Necessarily their schema would be a mess.

Also, what stops something like

    function add(int a, int b) -> int {
        return a-b;
    }
Typing is overrated. It has productive use cases for sure, but only in specific scenarios. It is no panacea.

What would be nice is typing like typescript - optional typing. Where i can provide a typings binding separate from the code (in the way that i can bring my own tests without changing anything of production code if you’ve made an unholy mess of testing). Same argument for optional typing outside the main source code - odds on you’re going to misunderstand or misuse types, I’d like to use them where they make sense and ignore your steaming pile of types. Impossible in a language like haskell where types are inline rather than annotations attached to code.

Re:Moving from TypeScript to Rust / WebAssembly by uryga on Thursday July 09, 2020 @05:20AM (#23778362)
> Also, what stops something like [defining add as subtraction]

cmon... "it doesn't guard you against every logic error under the sun" isn't a great argument

Re:Moving from TypeScript to Rust / WebAssembly by jashmatthews on Thursday July 09, 2020 @06:14AM (#23778616)
There's no strong evidence that static typing helps reduce application logic bugs https://danluu.com/empirical-pl/

Under the same pressures it's pretty likely that the same teams that deploy dynamic language code to production and get an unexpected nil deploy statically typed code to production which unwraps an unexpected None and throws exceptions or panics.

Re:Moving from TypeScript to Rust / WebAssembly by ImprobableTruth on Thursday July 09, 2020 @08:07AM (#23779281)
>There's no strong evidence that static typing helps reduce application logic bugs https://danluu.com/empirical-pl/

There's no evidence proving the opposite either. We can't say anything beyond that the existing studies don't really show anything. I think it's pretty obvious that the limit of static typing reduces logic bugs (since it can actually be used to prove statements about the logic), but beyond that everything is kind of up in the air.

>Under the same pressures it's pretty likely that the same teams that deploy dynamic language code to production and get an unexpected nil deploy statically typed code to production which unwraps an unexpected None and throws exceptions or panics.

There's nothing to support that that this is 'pretty likely'. As far as we know, it could very well be that statically typed languages push you in the direction of handling it the right way. Or hell, it could be that a team using a dynamic language is more cautious and conscious of edge cases.

Re:Moving from TypeScript to Rust / WebAssembly by ImprobableTruth on Thursday July 09, 2020 @07:57AM (#23779201)
I don't understand this reasoning at all. You have some form of contracts, whether you specify them or not. If it's too messy to formalize, that's still going to be an issue when you're working on it in an untyped language. At best you're just sweeping all those ugly edge cases under the rug.

>Also, what stops something like

having a more precise specification. E.g. adding a commutativity requirement would eliminate your example.

Re:Moving from TypeScript to Rust / WebAssembly by knubie on Thursday July 09, 2020 @07:51AM (#23779160)
> What would be nice is typing like typescript - optional typing. Where i can provide a typings binding separate from the code (in the way that i can bring my own tests without changing anything of production code if you’ve made an unholy mess of testing).

A contract system like clojure's spec sounds close to what you're describing.

Re:Moving from TypeScript to Rust / WebAssembly by pjmlp on Thursday July 09, 2020 @01:56AM (#23777334)
Having ridden the 90's .com startup wave with an in-house application server written in a mix of Apache plugins and Tcl, I learned the hard way to never again rely on anything that doesn't bring a JIT or AOT compiler to the party.
Re:Moving from TypeScript to Rust / WebAssembly by AbuAssar on Thursday July 09, 2020 @03:31AM (#23777823)
I’m interested in knowing more about your story. Would you please take the time to tell us more about it?
Re:Moving from TypeScript to Rust / WebAssembly by pjmlp on Thursday July 09, 2020 @04:02AM (#23777975)
Not much to publicly tell.

Portuguese startup based on our own version of AOLserver, based on the same principles of Apache plugins + Tcl + C, basically Rails before it was even an idea.

We got acquired, by another bigger Portuguese company (Easyphone), which alongside another acquisitions became Altitude Software.

Our stack was used to some of their products serving multiple top tier companies in Portugal, we created an IDE for our tools, written in VB.

Supported all major UNIX flavours and Windows NT/2000.

Eventually scale problems happened and we were looking how to tackle them while avoiding rewriting everything in C, as MSFT partner we got invited to try out .NET pre-public announcement, so we decided it was a good opportunity to rewrite our product in this new .NET thing.

Some of the team members eventually took all these lessons and founded OutSystems.

Re:Moving from TypeScript to Rust / WebAssembly by quickthrower2 on Thursday July 09, 2020 @02:58AM (#23777673)
What's the hard lesson? Performance? You have more power these days. The bottleneck won't be the interpreter.
Re:Moving from TypeScript to Rust / WebAssembly by pjmlp on Thursday July 09, 2020 @03:07AM (#23777711)
Performance yes, there is always more power as long as the bank account is full, and even then it isn't enough when working at scale.

The amount of histories of porting code prove otherwise.

Note I am not pushing away dynamic languages, only those that don't have a JIT/AOT as part of their canonical implementation.

Common Lisp, Julia, JavaScript, PHP (7 and later) are all invited to the party.

Meanwhile maybe JRuby or PyPy will eventually get more community love, instead of being the black swans.

Re:Moving from TypeScript to Rust / WebAssembly by PetahNZ on Thursday July 09, 2020 @03:20AM (#23777771)
But php doesnt have jit...
Re:Moving from TypeScript to Rust / WebAssembly by chaz6 on Thursday July 09, 2020 @03:28AM (#23777813)
JIT is coming to PHP in version 8.
Re:Moving from TypeScript to Rust / WebAssembly by DonHopkins on Thursday July 09, 2020 @07:22AM (#23778973)
Just In Time for 2020!
Re:Moving from TypeScript to Rust / WebAssembly by vbezhenar on Thursday July 09, 2020 @08:43AM (#23779552)
Java, .NET, Golang are actively used for web development. PHP is popular, especially for small projects, but it definitely did not win, web development is a contested area.
Re:Moving from TypeScript to Rust / WebAssembly by arcturus17 on Thursday July 09, 2020 @09:05AM (#23779725)
> PHP is popular, especially for small projects

Not especially for small projects, for projects of all sizes - huge swathes of the internet still run on PHP, and it's not limited to blogs built on Wordpress.

More than a few gigantic sites (Wikipedia and PornHub come to mind) are built with PHP. This is highly anecdotal but I still see the .php extension all over the place, sometimes in sites that perform really well BTW (again, Wikipedia is a good example here).

Re:Moving from TypeScript to Rust / WebAssembly by ThePhysicist on Thursday July 09, 2020 @04:41AM (#23778176)
They are also evolving though. I don't know about Ruby and PHP but in Python gradual typing via type annotations really makes projects much easier to maintain and develop these days. While "mypy" (the semi-official type checker tool) still has a long way to go in terms of library support it works really well and helped me to find many issues by analyzing the code, as opposed to running it and finding the issues via tests (or in production).

So I think typing has its merits and languages like Typescript really make development safer and code easier to understand, while still making it possible to write and interface with untyped code if necessary.

Re:Moving from TypeScript to Rust / WebAssembly by Lio on Thursday July 09, 2020 @05:13AM (#23778334)
> I don't know about Ruby

Ruby is moving in the direction with the addition of Sorbet[1] for gradual typing. I have heard some discussion that this typing could become a formal part of Ruby 3.0.

1. https://sorbet.org/

Re:Moving from TypeScript to Rust / WebAssembly by giantDinosaur on Thursday July 09, 2020 @06:04AM (#23778570)
I'm not sure this is really true - the subtleties of HTTP are not best handled with dynamic languages, and the actual HTTP API is fairly simple for most web app development. The areas with the most complexity related to the web, itself, are usually do with servers, concurrency, etc - precisely where these languages tend to fall apart.
Re:Moving from TypeScript to Rust / WebAssembly by entha_saava on Thursday July 09, 2020 @03:50AM (#23777925)
> This really nails why languages like PHP and Ruby have won out over static typed ...

Real reason is lowering the bar of entry, and that explains why web is horribly broken.

The "bootcamp webshit" meme exists for a reason. That's not gatekeeping - lowering the bar to entry below a certain level leads to drastic decrease in quality.

Re:Moving from TypeScript to Rust / WebAssembly by vorpalhex on Thursday July 09, 2020 @10:28AM (#23780614)
You realize the web started with just HTML at first right?

The web was always meant to be a platform anyone could easily build on, whether they were experts or someone's little old grandma who barely knew what a keyboard was.

Not only is it gatekeeping, it's historically wrong and betrays a flawed understanding of the platform. The web has always been about ease of use and there have always been people who went out of their way to teach others how to make good use of it.

Yes, the web is broken, but the web is broken because it's no longer about everyone running a little shoebox of a server and instead now we depend on giants who see us as cattle.

Re:Moving from TypeScript to Rust / WebAssembly by afarrell on Thursday July 09, 2020 @05:01AM (#23778271)
A lot of it is affordances. Every function signature is a user interface for your fellow programmer.

And if you are used to poorly-designed UI, you will expect poorly-designed UI from yourself.

Re:Moving from TypeScript to Rust / WebAssembly by entha_saava on Thursday July 09, 2020 @05:13AM (#23778336)
Less testing, Documentation, Guarding against typos, better IDE support, better performance;

But there is a whole new generation of web developers who don't bother to learn algorithms or low level programming, and just churn out code with that hot new framework. That kind of programmers are also the ones that choose a technology because "it looks easier".

The world would be nice if management people understood not all programmers are equal, the 10x programmer is not a myth. But here on HN or reddit you see most people arguing that all programmers are similarly productive. And what we get for this is more electron apps.

Re:Moving from TypeScript to Rust / WebAssembly by afarrell on Thursday July 09, 2020 @05:27AM (#23778413)
> the 10x programmer is not a myth

You are right that quality of programmer skill and productivity has high variance, but the way people talked about the "10x programmer" was a vague vision that people pasted their ideas and personal bugaboos onto. So people got into increasingly-heated arguments and talked past each other. When we create social concepts, we need to strive for something like falsifiability -- something that lets you look at an example and say "Well actually no, thats not 'high-performing programmer' behavior -- for {{describable reason}}"

Categories matter. We should shape our categories for human happiness and human effectiveness, but categories matter.

Re:Moving from TypeScript to Rust / WebAssembly by wwright on Thursday July 09, 2020 @09:44AM (#23780088)
I think it's really not that some programmers do 10x more, but some people with the same job title do a different job. Some engineers take responsibility for product or for ecosystem; some engineers tick off tasks on a list. (Both can be very valid, and bleeding for product quality at a company is definitely not inherently good.)
Re:Moving from TypeScript to Rust / WebAssembly by DonHopkins on Thursday July 09, 2020 @07:24AM (#23778981)
Is less because there are a few 10x programmers, and more because there are a whole hell of a lot of 0.1x programmers.
Re:Moving from TypeScript to Rust / WebAssembly by entha_saava on Thursday July 09, 2020 @05:52AM (#23778530)
True. That was a vague notion. I think Joel Spolsky's "Hitting the high notes" summarized it better.
Re:Moving from TypeScript to Rust / WebAssembly by afarrell on Thursday July 09, 2020 @05:32AM (#23778436)
> Less testing

Why?

Re:Moving from TypeScript to Rust / WebAssembly by entha_saava on Thursday July 09, 2020 @05:49AM (#23778516)
For example functions only take objects of supported types. Many invariants are verifiable at compile time. Especially when you have generics, structural typing and ADTs, the expressiveness is pretty good.
Re:Moving from TypeScript to Rust / WebAssembly by pjmlp on Thursday July 09, 2020 @01:39PM (#23782790)
Depends what one considers application level web development, over here it has been pretty much Java and .NET, with occasional C and C++ written libraries, during the last 20 years.
Re:Moving from TypeScript to Rust / WebAssembly by quickthrower2 on Thursday July 09, 2020 @02:57AM (#23777669)
This is probably true .... but watch out for Node with Typescript. You get that quite iteration, but with a decent amount of type safety most of the time, but with a drop down to the 'any' type for libraries that haven't written type definitions. I also use the existence of type definitions as a guide to how mature the library is :-), so that's a win win.
Re:Moving from TypeScript to Rust / WebAssembly by crimsonalucard9 on Thursday July 09, 2020 @11:01AM (#23781010)
This is a mistaken view point. Every function you can ever write is bounded by a type, thus whether you use Ruby, PHP, or Rust can be described by a bounded type.

Every time you write logic in your code, your brain is aware that the logic is dealing with a specific type. Writing a type signature on top of that is just additional instructions to the compiler about the type you have already specified in your logic. It is a minor inconvenience.

There are many reasons why Ruby and PHP won out. One of the reasons is many people misunderstand the power and flexibility of types. Once they understand this, they will know there is really no trade off between statically typed and dynamically typed. Statically typed languages are infinitely better and the only downside is a minor inconvenience.

First off, note that there is only one function in the universe that can really take every single type in existence and that function is shown below:

  -- haskell
  identity :: x -> x
  identity x = x

  # python
  def identity(x: Any) -> Any:
      return x
This is the only untyped function in existence. Every other function in the universe must be typed whether it is typed dynamically or statically is irrelevant, either way your code will have to specify the type in logic or in the type signature. You can see this happening in the examples below...

The above example have no logic to specify a type... The minute you start to add any logic to your function immediately your function becomes bounded by a type. Let's say I simply want to add one in my identity function.

  -- haskell
  identity :: Int -> Int
  identity x + 1 = x + 1

  # python
  def identity(x: Int) -> Int:
      return x + 1
The very act of adding even the simplest logic binds your function to a type. In this case it binded my function parameter to an integer. Whether you use PHP or Ruby or Rust there is a type signature that describes all functions.

Let's say I want to do garbage code like write a function that handles an Int or a String? That can be typed as well....

  --haskell
  type IntOrString = Number Int | Characters String
  func :: IntOrString -> IntOrString
  func Number n = n + 1
  func Characters n = n ++ "1"

  #python
  IntOrString = Union[str, int]
  def func(n: IntOrString) -> IntOrString:
      if isinstance(n, int):
         return n + 1
      if isinstance(n, str):
         return n + "1"

Let's say I want to handle every possible JSON api in existence? Well it can be typed as well.

   -- haskell
   type JSON = Number Float | Characters String | Array [JSON] | Map String JSON
   func :: JSON -> JSON
   func Array x = x ++ [1.0]
   func x = x

   -- python
   JSON = Union[float, str, List["JSON"], Dict[str, "JSON"]]
   def func(x: JSON) -> JSON:
     if isinstance(x, list):
        return x + [1.0]
     else:
        return x 

  
There really isn't any additional flexibility afforded to you by a dynamically typed language other than the slight overhead of translating the types you already specified dynamically into types that are specified statically.

One caveat to note here (and this is specific to haskell) is lack of interfaces specific to record types. I cannot specify a type that represents every single record that contains at least a property named x with a type of int.

Re:Moving from TypeScript to Rust / WebAssembly by swyx on Thursday July 09, 2020 @01:20AM (#23777161)
this was historically true, but I suspect in the age of the evergreen browser this argument has been seriously dented (but not invalidated)