News for hackers. Stuff that matters.
Re:John Carmack on Inlined Code (2014) by rakpol on Tuesday July 19, 2016 @08:56AM (#12121427)
I was thinking about the issue of nested code the other day -- isn't it (mostly) an editing environment problem? I mean, if my IDE can detect that a method is pure, couldn't it do a little magic (e.g. provide a different coloured background, some dotted boxes, etc.) and show me the inlined code right there? It doesn't seem wise to architect your codebase around the deficiencies in your tools, since one is (hopefully) going to long outlive the other.

Related:

[1]: https://dubroy.com/blog/method-length-are-short-methods-actu...

Re:John Carmack on Inlined Code (2014) by tibbon on Tuesday July 19, 2016 @09:01AM (#12121458)
Oh, i like this idea. Imagine your IDE just being able to substitute method calls that are just calling single line methods, for viewing only. Or even being able to refactor them in-line, but keep them in private methods?
Re:John Carmack on Inlined Code (2014) by slazaro on Tuesday July 19, 2016 @09:22AM (#12121552)
With Visual Studio, you can visually inline the definition of a function below its call by selecting "Peek Definition", which is close to what you're saying.

You can only do it one at a time, and it's for quick scanning of what the function does, though.

Re:John Carmack on Inlined Code (2014) by timlyo on Tuesday July 19, 2016 @10:51AM (#12122108)
I think Jetbrains ide's also have this. It's been a while though.
Re:John Carmack on Inlined Code (2014) by tibbon on Tuesday July 19, 2016 @10:00AM (#12121788)
Hmm, wonder if I can coax Sublime into doing that. It's a little closer to IDE-type functionality, which it's pretty weak on (refactoring is terrible for Ruby with it).
Re:John Carmack on Inlined Code (2014) by caf on Tuesday July 19, 2016 @09:09AM (#12121486)
Particularly if the editor can do things like constant folding and branch elimination based on constants that are being passed at that point.
Re:John Carmack on Inlined Code (2014) by jakub_h on Tuesday July 19, 2016 @06:53PM (#12125567)
That's just the editor doing the compiler's work at edit time, though. I know that Chuck Moore has always advocated extreme early binding, but that really is usually associated with Forth, not with mainstream languages.
Re:John Carmack on Inlined Code (2014) by caf on Tuesday July 19, 2016 @09:08PM (#12126177)
I didn't mean that the editor would change what was presented to the compiler, just that it would simplify for the user when expanding the use of helper functions.
Re:John Carmack on Inlined Code (2014) by taneq on Wednesday July 20, 2016 @09:23AM (#12128797)
> By making your methods shorter, you’re just trading one kind of complexity for another.

Oh, I want to frame this and put it on the wall.

I can't stand code where even the simplest thing is implemented as a giant tree of sub-5-line functions nested 15 deep (and probably, for bonus points, scattered across half a dozen files).

Re:John Carmack on Inlined Code (2014) by perspectivep on Tuesday July 19, 2016 @09:23AM (#12121560)
Visual Studio has had that for awhile now.

http://msdn.microsoft.com/en-us/library/dn160178.aspx

Re:John Carmack on Inlined Code (2014) by softawre on Tuesday July 19, 2016 @10:50AM (#12122095)
VSCode has this as well.