Skip to main content

Questions tagged [macro]

Use this tag for questions about design or implementation of language preprocessor macros that are able to perform limited rewriting of source code before evaluation. Do not use for questions about editor macros or design of automation languages.

Filter by
Sorted by
Tagged with
1 vote
1 answer

Implementing automatic derivation without macros?

In Rust: #[derive(Display)] struct Foo<T>(T); If T conforms to the Display trait, ...
Jw C's user avatar
  • 231
9 votes
1 answer

How does Rust parse ambiguous macros?

Rust's macros require them to be delimited by either parentheses, braces, or brackets, such as println!(arg) or foo! { bar, baz }...
Seggan's user avatar
  • 2,723
31 votes
3 answers

Why did Rust require macro names to have an exclamation point at the end?

Why did the designers of the Rust programming language require that macro names have to end with an exclamation point? I observe that both Common Lisp and Emacs Lisp language variants do not appear, ...
bgoodr's user avatar
  • 413
3 votes
2 answers

How can the pitfalls of preprocessor macros be mitigated/avoided?

A controversial topic among programming language designers is preprocessor macros such as #define directives in C. They can cause problems if used incorrectly. <...
CPlus's user avatar
  • 8,321
19 votes
6 answers

How could a language with a C-style syntax implement homoiconicity?

A part of why Lisp's macros work so well is that the code is just a list of symbols, and it is therefore simple to manipulate using a regular Lisp function. How could a language that uses a syntax ...
kouta-kun's user avatar
  • 1,359