4 ms·
I actually really like a "format on save; don't format without AST" combination. It's really nice knowing as soon as you hit ctrl+s whether you've just written
by eterm 7y ago
I actually really like a "format on save; don't format without AST" combination.
It's really nice knowing as soon as you hit ctrl+s whether you've just written in a syntax error or not.
- klodolph 7y agoThis is how I have Emacs set up, but when I use VS Code I really appreciate that syntax errors get the red squiggly underlines.
- k__ 7y agoYes, it's like people try to make more science of it than it really is...
- saagarjha 7y agoI know that I’ve missed a delimiter when clang-format arbitrarily adds a level of indentation to the latter half of the file.
- dmit 7y agoTo see this concept taken to its logical conclusion, check out Casey Muratori write C code with the editor configured to reformat on every keystroke: https://www.youtube.com/watch?v=S3JutszP9fg&t=11m37s https://www.youtube.com/watch?v=S3JutszP9fg&t=11m37s I'm not sure I'd ever go this far, but that might just be years of conditioning by editors that format code much more slowly than the fork of 4coder that he's using in the video.
- lioeters 7y agoThe idea of autoformatted code editing is intriguing. I've been exploring that (plus instant preview/eval, but that's another story) in a home-made language with a basic editor. For smaller files/modules it's totally feasible to do on every key press, fast enough to be fairly seamless. It took a bit of getting used to, but there's something catchy about the experience, like molding clay - if the clay was made of a "smart material" that re-formed itself to an optimal shape. The immediacy of working with self-reshaping code (and live reload too) reduces mental friction, so I can forget about formatting or compilation altogether. I hope more languages make it a part of the developer experience, IDE, etc.
- dmit 7y agoI feel like it's a subset of a much larger, more general topic of how latency impacts computer interactions. People have long tried to emulate real-world activities in computer programs, but not much attention has been paid to making those programs instantaneous. When you mold clay, there is no lag - the tactile and visual feedback is immediate. Same with handwriting, painting, or petting a dog. On the other hand, even in this current world of multi-core 4Ghz+ computers most software fails to provide immediate feedback. 100ms, I believe, is the magic number. The maximum delay between cause and effect that still registers as "instantaneous" by the human brain. Yet, surprisingly, it's still a rarely reached target. FPS video game studios might be the only major industry that consistently cares about and delivers on this metric. (Edit: "major" was an intentionally vague word to use here. Obviously, all kinds of embedded software projects have to deal with real-time or soft-real-time requirements.) If reformatting the whole current code file took 1ms, why wouldn't you enable it? If compilation took 50ms, why not recompile on each new line? There's a magic latency barrier below which actions feel "free", so why not try and move as many of them as possible below that threshold?
- lioeters 7y ago> When you mold clay, there is no lag Wonderful phrasing. On the importance of immediate feedback in the creative process, it reminds me of audio/music production - in particular, MIDI instruments. The latency between keypress and sound reaching the ear should be as close to zero as possible. Recently I read a discussion about remote collaborative music performance. From what I understood, network latency is not nearly low enough to achieve it. There's also the physical limit of the speed of light. 10ms was mentioned as acceptable for musicians - but then someone said, even when musicians are in the same room, there can already be too much latency if it's a big room and they're distant from each other, making it difficult to play together. > why not recompile on each new line? This is becoming the standard in web development, with incremental compilation (and "hot reload" on the client) of only the changed code/module. I saw that it's getting applied in building mobile apps as well, to get closer to the ideal of instant feedback. In thinking of the ideal developer experience, I often come back to Bret Victor's work, Learnable Programming. http://worrydream.com/#!/LearnableProgramming http://worrydream.com/#!/LearnableProgramming