Macros are used to make a sequence of computing instructions available to the programmer as a single program statement, making the programming task less tedious and less error-prone.[
1
vote
1answer
181 views
What is this programming style? “Monoid-ic”?
In a moderately old blog post, Conal Elliot makes an interesting (if less than serious) argument that C is a purely functional language, by drawing a parallel between the combination of the C ...
6
votes
1answer
190 views
Is it fair to say that “macros don't compose”?
On this blog post aphyr (who is a brilliant programmer) states:
Clojure macros come with some important restrictions. Because they’re expanded prior to evaluation, macros are invisible to ...
0
votes
2answers
145 views
Is it acceptable to use C11 generic macros in Objective-C to box numbers?
I was getting tired of repeating types when writing things like this:
NSDictionary* d = @{@"so": [NSNumber numberWithInt:index]),
@"much": [NSNumber numberWithBool:accepted]),
...
9
votes
4answers
649 views
Python decorators and Lisp macros
When looking Python decorators someone made the statement, that they are as powerful as Lisp macros (particularly Clojure).
Looking at the examples given in PEP 318 it looks to me as if they are just ...
2
votes
3answers
562 views
Does macros support make Scala a Lisp dialect?
I've read recently that macro support in Scala is now official. I checked the documentation page and they are reminiscent to the LISP ones. In one of his essays Paul Graham writes that when "you add ...
7
votes
2answers
374 views
When would I require a Macro instead of a function?
I am new to Clojure, I am new to Macros and I have no prior background in Lisp.
I went on to create my own switch case like form and ended up with this:
(defmacro switch-case [v cases default] (if ...
2
votes
2answers
995 views
Why can't we declare 'extern C' for C++ macro's?
I am new to C/C++. Wanted to know why we cannot declare 'extern C' for C++ macro's similar to methods/functions...which will allow macro's defined in C++ file to be accessed in .c files.
Thanks in ...
11
votes
3answers
560 views
Byte code weaving vs Lisp macros
I have been reading about the libraries people have written for languages like Java and C# that make use of byte code weaving to do things like intercept function calls, insert logging code, etc. I ...
3
votes
2answers
369 views
Besides macros, are there any other metaprogramming techniques? [duplicate]
Possible Duplicate:
Programming languages with a Lisp-like syntax extension mechanism
I'm making a programming language, and, having spent some time in Lisp/Scheme, I feel that my language ...
18
votes
19answers
3k views
Programming languages with a Lisp-like syntax extension mechanism [closed]
I have only a limited knowledge of Lisp (trying to learn a bit in my free time) but as far as I understand Lisp macros allow to introduce new language constructs and syntax by describing them in Lisp ...
1
vote
1answer
152 views
Is there a way to compare and record changes to code without VCS?
I'm working for a client that has no version control system in place. I want to record changes to code without having to add all changes to a spreadsheet. I'm restricted to using Notepad++ so would a ...
14
votes
1answer
1k views
Why does the C library use macros and functions with same name?
I am reading 'The Standard C Library' by PJ Plauger which is really interesting. The book explains not only how to USE the library but also how it is implemented.
I have finished reading the ctype.h ...
6
votes
1answer
238 views
Lisp Macros: A practical approach
On my way to learn Lisp I have discovered the all powerful and feared so called Macros, then after spending a hard time trying to understand them and their usefulness I said to myself, I FINALLY GOT ...
18
votes
2answers
707 views
What are the typical applications of Lisp macros?
I am trying to learn some LISP and I have read a lot about the importance of LISP macros so I would like to get some working experience with them.
Can you suggest a practical application area that ...
-4
votes
2answers
388 views
Why #pragmas are not part of the C++ standard?
Usually the problem of having possible multiple inclusions is solved with a series of #ifdef #ifndef but the pragmas just solves this with a single line, apparently they are really useful and can make ...
1
vote
2answers
355 views
Using macro as an abstraction layer
I am having a discussion with a colleague about using macro as a thin (extremely) layer of abstraction vs using a function wrapper. The example that I used is
Macro way.
#define StartOSTimer(period) ...
2
votes
3answers
158 views
What do you use macros in your editor for? [closed]
My editor of choice is Notepad++. It has macro capabilities, but as much as I think, I don't see how can I use it for anything.
Do you use macros in your editor that have made your work easier? ...
2
votes
1answer
1k views
Why no more macro languages?
In this answer to a previous question of mine about scripting languages suitability as shells, DigitalRoss identifies the difference between the macro languages and the "parsed typed" languages in ...
13
votes
5answers
1k views
How useful are Lisp macros?
Common Lisp allows you to write macros that do whatever source transformation you want.
Scheme gives you a hygienic pattern-matching system that lets you perform transformations as well. How useful ...
16
votes
5answers
3k views
Are C++ templates just a kind of glorified macros?
From different comparisons among C++ templates and C#/Java generics like this one-
...
5
votes
3answers
841 views
Is macros support in a programming language considered harmful?
The first abuse that comes to my mind in C is:
#define if while
But at the same time it is extremely handy and powerful when used correctly.
Something similar happens with Common Lisp macros.
...
20
votes
7answers
3k views
Why aren't macros included in most modern programming languages?
I know that they are implemented extremely unsafely in C/C++. Can't they be implemented in a safer way? Are the disadvantages of macros really bad enough to outweigh the massive power they provide?