4 ms·
Depends on what you think they’re masters of. Developer experience? Sure. Modern programming languages design? Absolutely not.
by saagarjha 3y ago
Depends on what you think they’re masters of. Developer experience? Sure. Modern programming languages design? Absolutely not.
- Someone 3y agoBut developer experience is a factor that should weigh heavily in evaluating the quality of a programming language. I also fear Swift is going a step too far. For example, IMO Swift's compilation speed isn’t good enough. If that’s a matter of lack of tooling, I won’t blame the language, but is it, or is its slowness unavoidable for a language that is so flexible? If the latter, I would rather have a bit less flexibility and more compilation speed. Similarly, there’s quality of error messages. Swift has gotten better there, but still has some weird ones. Are they unavoidable for the current language?
- dagmx 3y agoWhen discussing compiler speed, Go specifically prioritizes compilation speed over optimization of the resulting code. Swift and Rust both suffer from slower compilation than Go, primarily because LLVM prioritizes optimization over speed. There are of course other reasons like complexity of language, size of compilation units etc… but optimization tends to be the biggest hit in my experience. Hence why Rust is adopting/investigating cranelift as a debug compiler to improve speed.
- Someone 3y ago> There are of course other reasons like complexity of language, size of compilation units etc… but optimization tends to be the biggest hit in my experience. I guess you don’t have much experience with Swift. LLVM code generation may be slower than alternatives, but that’s more or less by a constant factor. Swift’s type inference, on the other hand, can lead to a combinatorial explosion. For example, https://www.hackingwithswift.com/articles/11/how-to-make-swift-compile-faster https://www.hackingwithswift.com/articles/11/how-to-make-swi... claims that let sum = [1, 2, 3].map { String($0) }.flatMap { Int($0) }.reduce(0, +) takes over 11 seconds to compile, while compare this code: let sum = [1, 2, 3].map { (num: Int) -> String in String(num) }.flatMap { (str: String) -> Int? in Int(str) }.reduce(0, +) takes about 75ms, and let numbers = [1, 2, 3] let stringNumbers = numbers.map { String($0) } let intNumbers = stringNumbers.flatMap { Int($0) } let sum = intNumbers.reduce(0, +) compiles in 71ms. Of course, all of these use LLVM, and likely even generate highly similar intermediate code. Also, you’ll see these slowdowns even in debug builds that don’t ask LLVM to optimize code much.
- dagmx 3y agoPretty rude to start your comment with the assumption that I’m not experienced with Swift. The rest of your comment would be more useful without the unnecessary condescension. But nothing you said contradicts what I said either. Yes it’s easy to get into slow paths with Swift, but it’s also easy not to. Granted it takes a lot of up front knowledge to do so. But even if you just stick to the LLVM portion, llvms debug mode is slower than cranelift and other toolchains debug modes. Debug doesn’t mean “no optimizations” whatsoever, nor does it mean efficient paths through the toolchain either.
- cvwright 3y agoI would be fine with slow, if the Swift compiler could actually compile all valid Swift programs. It’s pretty commonplace for me to have to break a large or complicated function into smaller bite-size pieces because the compiler can’t type check it all at once.
- jwells89 3y agoThis used to irritate me, but now that I'm in the habit of breaking functions up I've come to prefer it. It makes for code that's easier for myself to read and follow further down the road, which I think is a reasonable proxy for readability by others.
- cachvico 3y agoWriting modular code is good but that's a ridiculous reason to need to do so. Xcode also trips on simple type errors and sometimes fails to even provide a line number where the error lies. As someone who just wrote a Swift app after no prior exposure, it's oddly immature in some basic ways after nearly a decade from launch.
- jwells89 3y agoYeah I won’t defend it too much, Xcode/SourceKit/etc are clearly written in a way that assumes devs are writing perfectly idiomatic, smell-free code which isn’t very aligned with reality. I’ve more or less got a feel for what makes it grumpy so I don’t trip it up too often any more but it’s annoying on the odd occasion I do.
- cvwright 3y agoYeah this is a major pet peeve. Especially when the compiler crashes. Growing up writing in C, I didn’t even know that was a thing.
- newZWhoDis 3y agoIf you are writing functions that the current/latest Swift compiler can’t handle on modern hardware then I feel sorry for anyone who has to someday read your code.
- ori_b 3y agoWhat is the purpose of modern language design, if not to improve developer experience?
- jb1991 3y agoIt's a subjective issue, but sometimes the end results can be better even if the experience of getting there is not as nice as a simpler language that is more bug-prone. Consider Rust, which is notoriously difficult to learn, but that offers improved end results in many cases re: security, safety, reliability.
- ori_b 3y agoCan you explain how that's not an aspect of developer experience? It seems to be like trading off between type system correctness (you can go all the way to needing full formal proofs of correctness, resource use, etc) and ease of getting stuff done is the core of developer experience.
- worik 3y agoWith Rust it is the learning curve that is hard. I find every other aspect of "developer experience" excellent
- jb1991 3y agoDoes your idea of a good developer experience include programs that are reliable, won't crash in production, won't be compromised, and save you lots of time later on so you can just focus on writing code the first time? In the absence of these guarantees, your developer experience can include some very frustrating and/or stressful debugging.
- ori_b 3y agoYes. Does yours not? Tools like Agda, Spark, Idris, and Coq move the tradeoff around towards "probably correct", and I welcome seeing some of their features become gradually available. Getting things right the first time is useful. But these features can also make it hard to get anything done quickly. Good developer experience means finding a balance between the quick and dirty, and the provably correct.
- tempodox 3y agoI think Go is made for writing a certain kind of software that is important for Google, and for a certain kind of developer Google wants to have writing this software. That the result is not the kind of language I would want to use is immaterial. I'm quite sure Go is masterfully targeted for the purposes Google wants it for.
- pjmlp 3y agoGo was designed by a couple of well known UNIX folks that dislike C++. With exception of Kubernetes, most of Google's software keeps being written in Java, C++, Kotlin, and nowadays Rust. Its use is much more widespread outside Mountain View walls than inside them.
- seabrookmx 3y agoAnd remember that unlike Amazon does with AWS, Google doesn't use GCP/Kubernetes to run it's infrastructure. Google's software runs on Borg, which is _not_ written in GoLang. Google's three OS projects all eschew GoLang as well.
- slinkyavenger 3y agoBoth criticisms are pointless - 1. Borg precedes K8s and likely is tightly coupled with Google's backend infra - that's to say, Borg gets architected around Google's existing workflow and new backend development is written around Borg's workflow. 2. GoLang was never intended to be an OS-level programming language. It was created to enable more robust, efficient, and rapid development in a particular space. It would be just as silly to argue that Google's three OS projects all eschew Dart.
- vips7L 3y agoIsn’t Fuchsia designed to use Dart for the front end?
- seabrookmx 3y ago