Live data from Hacker News

John Carmack on inlined code (2014)

number-none.com

401–402 of 402 posts

Re: John Carmack on inlined code (2014)

#401

Here are some information theoretic arguments why inlining code is often beneficial: https://benoitessiambre.com/entropy.html In short, it reduces scope of logic. The more logic you have broken out to wider scopes, the more things will try to reuse it before it is designed and hardened for broader use cases. When this logic later needs to be updated or refactored, more things will be tied to it and the effects will b…

Here is a followup post for those interested: https://benoitessiambre.com/integration.html

Re: John Carmack on inlined code (2014)

#402
post #55

I wish languages had the following: let x = block { … return 5 } // x == 5 And the way to mark copypaste, e.g. common foo { asdf(qwerty(i+j)); printf(“%p”, write)); bar(); } …(repeats verbatim 20 times)… … common foo { asdf(qwerty(i+k)); printf(“%d”, (int)write); // cast to int bar(); } … And then you could `mycc diff-common foo` and see: : : common : : common … : : @@…@@ -asdf(qwerty(i+j)); +asdf(qwerty(i+k)); @@…@@…

You can do this in...

  # perl
  my $x = do {
     …
     5
  };

  ;; Rebol/Red
  x: do [
     …
     5
  ]
Post reply on HN