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.

1 vote
1 answer
171 views

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
  • 241
9 votes
1 answer
691 views

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,743
31 votes
3 answers
12k views

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
105 views

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,341
19 votes
6 answers
1k views

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