Skip to main content
10 events
when toggle format what by license comment
Aug 17, 2020 at 12:55 history made wiki Post Made Community Wiki by maple_shaft
Nov 30, 2017 at 9:09 comment added Pete Kirkham @leftaroundabout that is what I said - they generate code without it being text. Plenty of code isn't text - machine code, byte code, cons cells (IME "s-expressions" normally refers to the text representation, but CLHS has both object and text for expression lispworks.com/documentation/HyperSpec/Body/… ).
Nov 29, 2017 at 20:48 comment added leftaroundabout @PeteKirkham Lisp macros don't really generate code, they generate S-expressions. Sure, you could dump these in text form and thus get Lisp code again, but that's not usually done because it would incur parsing overhead. (This is part of the reason why Lisps tend to be faster than other dynamic languages: the light list-based syntax can be held very efficiently in memory. Actually, I think e.g. Python also pre-compiles source file to a more efficient, non-text representation.)
Nov 29, 2017 at 13:19 comment added Captain Man @SeanBurton C has macros, which is sort of like code generation.
Nov 29, 2017 at 11:45 comment added Sean Burton Yeah, code-generation is essentially meta-programming. Languages like Ruby allow you to do meta-programming in the language itself, but C does not so you have to use code-generation instead.
Nov 29, 2017 at 10:53 comment added Pete Kirkham @Wilson the more expressive languages often use code generation (e.g. lisp macros, ruby on rails), they just don't require in to be saved as text in the meantime.
Nov 29, 2017 at 10:49 comment added Nick Keighley You don't usually get to pick and choose your implementation language. The project was in C, that wasn't an option.
Nov 29, 2017 at 10:23 comment added Omar and Lorraine @NickKeighley Perhaps your toolchain was not permitting you to use another more suitable language?
Nov 29, 2017 at 9:29 comment added Nick Keighley Highly repetitive code in inexpressive languages. For instance I had to write code that essential did the same thing on many similar but not identical data structures. It probably could have done with something like a C++ template (hey isn't that code generation?). But I was using C. Code generation saved me writing lots of near identical code.
Nov 29, 2017 at 5:16 history answered Maybe_Factor CC BY-SA 3.0