News for hackers. Stuff that matters.
Re:Val, a high-level systems programming language by rcxdude on Tuesday July 18, 2023 @07:52PM (#36780536)
in most compiled languages you need something like them to get fully featured metaprogramming. It's not necessarily a case of liking them so much as they often become the best option. (note that C macros are a terrible implementation of macros, and yet despite that and the C++ committee hating them with a passion they are still often the only way to do certain things in C++, because the C++ committee has not sought to make better macros but attempt to extend other language features to accommodate some of their use cases.).
Re:Val, a high-level systems programming language by preseinger on Wednesday July 19, 2023 @12:02AM (#36781989)
metaprogramming is not a virtue

programming languages do not themselves need to be programmable

Re:Val, a high-level systems programming language by pjmlp on Wednesday July 19, 2023 @01:54AM (#36782575)
That is why stuff like m4 gets born.
Re:Val, a high-level systems programming language by rcxdude on Wednesday July 19, 2023 @02:44PM (#36791287)
My experience suggests otherwise. If the appropriate facilities don't exist in a language, users will resort to code generation.
Re:Val, a high-level systems programming language by preseinger on Wednesday July 19, 2023 @03:25PM (#36791851)
usually, code generation is preferable to metaprogramming, mostly because it is easier to understand and maintain
Re:Val, a high-level systems programming language by kazinator on Wednesday July 19, 2023 @05:59PM (#36794070)
Code generation is just external macros; it's the same thing in a worse form.

To maintain the code, you have to understand the input language to the code generator and its metaprogramming constructs. You're no better off in that regard.

The grandparent comment is saying that if you don't give people metaprogramming built-in, they will resort to outboard metaprogramming.

I.e. you can't stop people from metaprogramming.

Re:Val, a high-level systems programming language by preseinger on Thursday July 20, 2023 @07:11PM (#36808045)
code generators are programs written in an existing programming language, which produce target language source code as output

macros are programs written in a separate, unique, often turing-complete meta-language, which is implemented entirely in the compile phase of the language which supports them

they're in no way equivalent