8 ms·
As a datapoint for your hypothesis, when working in a typed language I will build my code only a few times a day. I much prefer working from a logical and thou
by byteofbits 6y ago
As a datapoint for your hypothesis, when working in a typed language I will build my code only a few times a day.
I much prefer working from a logical and thoughtful approach rather than iteration. At the point where I start a build I am already reasonably confident that it will do what I want it to.
There are some bugs where I will need to re-build several times consecutively but these are relatively rare for me (I work on REST API systems - so nothing too crazy).
- johnfn 6y agoThat's really interesting. Compiling only a few times a day is mind boggling to me - in a normal day I'd probably average hundreds to a thousand compilation cycles! The main thing that I use compiling for is to validate little off-by-one things. Like, is substring() exclusive on the second parameter? What about range syntax and the slice operator? What if I wrote + 1 instead of - 1 somewhere, or did < instead of <=? I could spend a few minutes combing documentation, or just compile it and check immediately. Well, assuming compilation is fast anyways.
- wiz21c 6y ago>> in a normal day I'd probably average hundreds to a thousand compilation cycles! Maybe it's time to switch to an interpreter ? :-)
- logicchains 6y agoOr a language like Go, C or Nim that can compile tens of thousands of lines of code in a few seconds.
- pjmlp 6y agoOr OCaml, Java, C#, F#, Eiffel, Delphi,...
- hellofunk 6y agoJust googling “f# compile times” would beg to differ.
- pjmlp 6y agoApparently you didn't bother to read the 3 answers that come up. Only one of them says anything and it an empty statement like > F#'s compile times also seem to err on the long side but not very much so, my impression goes. However it is quite easy to validate write the same algorithm in F# and Rust and then compare. Ah but Rust is AOT compiled, easy, use NGEN, .NET Native, or Mono AOT for the F# compile time measurements.
- hellofunk 6y agoApparently you assume that everyone’s google results are identical.
- pjmlp 6y agoApparently you are too lazy to actually come up with some numbers of Rust compile times being faster than F# compile times. Offloading to Google is so much easier.
- chrisoverzero 6y agoIf that’s the case, then there’s no point in making any claims about what “just googling ‘f# compile times’ ” will reveal.
- setzer22 6y agoI've had a reviewer in a (scientific) journal tell me some paper is relevant, and thus I need to cite it, because it "appears on their top google results". People should be educated on the huge bias introduced by personalized services like google.
- LandR 6y agoI've worked in a C# code base where compiling the solution took 40 minutes.
- tastyminerals2 6y agoYou forgot about D, where you can basically bind ctrl+s to rdmd in your favourite IDE and enjoy scripting language akin experience.
- vips7L 6y agoD is sadly very underrated.
- mlindner 6y agoMy day job is in C and compile time is 30 minutes. It really depends what you're working on.
- logicchains 6y agoDoes it take that long for an incremental build?
- wiz21c 6y agoI've used Nim just a bit on Windows/MingW (I'm from python world). The very short program I made (about 200 lines, mostly math stuff, no framework imports) compiles in 2-3 seconds. It's already too long for me to iterate (it's not a rant against Nim, it's just that it's too long for my way of working; the language is nice and gives good results). Also note that Nim compiles fast, it's the compile-to-native compilation step that takes 90% of the time.
- johnfn 6y agoYou mean a REPL, or an interpreted language? I'd love a REPL that could somehow load the state of my entire app so I could test stuff out, but I've never found a language that could do that and also had reasonable type safety guarantees.
- estsauver 6y agoSome of the best solutions to that world right now seem to be things like lisps with dynamic typing added. You get a great set of repl support, but you can also build components and systems into easy wrapper scripts to load them as needed.
- hellofunk 6y agoI assume you mean static typing enabled. Because lisps are already dynamically typed to begin with.
- estsauver 6y agoThanks, I actually meant gradually typed systems, like rust typed or closure with heavy spec usage.
- hellofunk 6y agoI think you mean Clojure. Closure is something different.
- estsauver 6y agoWhat a terrible day for autocorrect, thank you.
- slifin 6y agoClojure has a java type system which can be partially enforced statically with clj-kondo Clojure spec is great at system boundaries but it's hard to describe it is a type system, it's a predicate system it can define very arbitrary constraints mostly at runtime
- _-___________-_ 6y ago> The main thing that I use compiling for is to validate little off-by-one things. Like, is substring() exclusive on the second parameter? What about range syntax and the slice operator? What if I wrote + 1 instead of - 1 somewhere, or did < instead of <=? I could spend a few minutes combing documentation, or just compile it and check immediately. Well, assuming compilation is fast anyways. I'm a really big fan of reading the docs (or, where the docs are insufficient, the source), and will always have docs.rs open alongside my editor. While the examples you provide are easily validated by testing (and I'd probably use `evalr` in `##rust`, or some similar thing, for them), many subtleties can exist in more complex functions, so not reading the docs/source for unfamiliar functions feels like programming-by-guessing to me.
- johnfn 6y agoPerhaps my examples were a little too trivial. I do a decent amount of game/graphics coding, so there's a lot of "hmm, does this look good 20 pixels over? How about 18?" and I don't know how you'd get around that without recompiling. (OK, you could read preferences from a file, but then you'd have to optimistically write every value you'd ever want to recompile to a file. I've tried this, but it's far too much overhead.)
- smt88 6y ago> I do a decent amount of game/graphics coding, so there's a lot of "hmm, does this look good 20 pixels over? How about 18?" and I don't know how you'd get around that without recompiling. I know exactly what you mean. Front-end development can be this way, too. I think it's OK (and probably true) to say that you shouldn't use Rust for cases like this right now.
- nicoburns 6y ago> I think it's OK (and probably true) to say that you shouldn't use Rust for cases like this right now. I think that's true, but only because of the slow compile times. Which is why they're so frustrating. Rust would otherwise be an excellent language for these use-cases.
- hrydgard 6y agoIf you have an editor with syntax checking such as VS Code with rust-analyzer, it checks syntax in the background as you type, saving you a lot of compile cycles. It doesn't yet scale very well to huge projects but getting better every week - rust-analyzer is under very heavy development.
- zozbot234 6y ago> The main thing that I use compiling for is to validate little off-by-one things. Like, is substring() exclusive on the second parameter? What about range syntax and the slice operator? What if I wrote + 1 instead of - 1 somewhere, or did < instead of <=? Rust has a testing facility that can be used for these things. By default, all "example" code that's included as part of a doc comment ends up in the test suite. And because test cases are small and self-contained, they're also very quick to compile.
- dan00 6y agoI've to say, I really hate this way of working, which might be the reason why I prefer statically typed languages like Rust. I think the main reason why I dislike working with dynamically typed languages is that most of them make the reasoning of code a lot harder. If you're able to reason about the code at hand, then there's a lot less need to run the code for every small change.
- addicted 6y ago> is substring() exclusive on the second parameter I can’t imagine not looking up the documentation to do this. If a language had a REPL I may then confirm it in the REPL, but almost certainly would pull up the docs first.
- ewindal 6y agoAssuming you take ~4 seconds from wanting to compile til you have your answer, that’s 60 minutes a day for a thousand compiles. An hour. Doesn’t seem very efficient to me.
- drej 6y agoNot OP, but these things don't have to be synchronous. I sometimes have entr running in a separate terminal, which tests and builds on every save. I don't wait for it to happen, but I do see it if it errs.
- Radim 6y agoAs one more datapoint, I do this (=barely ever "compile" / run) even in dynamically typed languages. My primary is Python. Definitely a leftover from when I was a kid, in the early 90s, without ready access to computers. I remember lying at a hospital bed and filling pages and pages with C64 programs, using pen and paper. This kinda forced me into the paradigm of "think through invariants and structure first". To this day, typing code out on a computer (incl. compilation) is almost mechanical, not a vital part of the design process.
- vaylian 6y ago+1 for that data point. The type system allows me to be much more explicit with regard to what I expect my code to do. And Rust-analyzer helps me spot those parts that don't fit together. But I typically turn it off, until I am actually done with defining all data types. I also use assertions and unit tests, because the type system still has its limitations (or some things would be too awkward to express), but I can move forward a long way without actually compiling a project.
- tegeek 6y agoThat's spot on. I mostly work with C#, F# in a day to day job and I build my code only a few times. This is also true when I work with Java, Angular and TypeScript. When I pick a new feature to implement I design that on paper with pencil and then mostly translate that to code. Mostly I can code for hours without compiling since this is where Typed Languages have strength.
- pjmlp 6y agoTry to do design GUIs without compiling. :)
- tegeek 6y agoI agree that whenever I've to "adjust" something in HTML, CSS, its always a struggle with multiple tries and write-run-write-run cycle. But again, this has nothing to do with how you design and write code in a static language.
- pjmlp 6y agoSure it does, for example in SSR frameworks, you want the HTML template engine or UI designer to see those components.
- GordonS 6y agoI guess it depends what you're working on. I mostly work with C#, and occasionally I might only end up compiling the project a couple of times in a day, but I'll probably be building a test project several times in the meantime (e.g. after adding each test). Alternatively, if I'm building a web GUI, I'll probably be building quite frequently, making sure that data is bound correctly and that the UI looks as expected.
- secondcoming 6y agoThat's very interesting. I can never work that way. I compile constantly (C++)
- tsimionescu 6y ago
- pjmlp 6y agoThat doesn't work for GUIs, which in this case would be SSR.
- flohofwoe 6y agoAs a counterpoint, I'm mostly working in typed, compiled languages, and I compile and debug-step through my changes in much smaller increments (usually a couple of minutes). But this only works because part of the work is to always fight 'compile time bloat'. It is easy to let a project slowly slide into a state where this workflow is no longer possible, especially in high-level languages like modern C++ or Rust, when even incremental builds take so long that it throws you out of "flow". But anyway, I think this sort of working style doesn't have to do with a language's type system, but is a personal choice and one isn't necessarily better than the other, but certain personalities might be attracted to certain language communities, and thus directly influence priorities (e.g. a large part of the 'modern C++' community seems to think that compilation time and good runtime performance in debug builds are not high priorities, which from my point-of-view is entirely irrational).
- Akronymus 6y agoI am in a completely different environment than you, but for desktop dev, I need to recompile constantly to verify alignment of usercontrols and such. So, for my workflow relatively fast compile times are mandatory. (Altough, I really wanna get out of desktop dev.)
- murukesh_s 6y agoI have seen few, often genius programmers do that. but not everyone can have a mental map of the code like that. we just need to run and fix part by part.. may be it's matter of practice, but that's the way several programmers workflows are.