3 ms·
While technically independent of the C language, the C pre-processor has the idea of C tokens baked into its core (such as refusing to ## together two things th
by saurik 11y ago
While technically independent of the C language, the C pre-processor has the idea of C tokens baked into its core (such as refusing to ## together two things that would result in invalid C), which has caused some people (such as Haskell) who relied on the ability of some C pre-processors to sort of handle things that are not C, they have been burned as of late when dealing with ones that have refused to implement extra modes that allow it to process arbitrary text (such as clang).
The preprocessor is essentially specified so as to be able to be efficiently implemented inside the tokenizer of a unified C compiler stack (hence why token pasting isn't textual): it isn't really "independent from the C language". In contrast, m4 is fundamentally more "independent" than the C preprocessor, in that (as far as I know... my experience with m4 is much less, and mostly with respect to amateur-level autoconf work) it doesn't assume anything about the underlying text.
- geofft 11y agoOne of the curious things about clean layers of abstraction is how often they're counterproductive in practice.
- hzhou321 11y ago>> m4...doesn't assume anything about the underlying text. I don't think there is anything wrong for the meta layer (syntax layer) to make certain assumptions/restriction for the underlying language layer; and there is nothing wrong for the meta layer to reflect certain characteristics of the underlying languages. The argument is: syntax matters, but it is not necessary to judge (or even reject) a language by its syntax, which may be remedied by a meta layer. It is not necessary to reject a person by his clothes or even how he talks. The same should go to a programming language.