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.[

learn more… | top users | synonyms

-1
votes
0answers
22 views

Get defines dynamically for messages [migrated]

In this following code, i want to use predefined message for my errors_manager function, with the macro CALL_MSG(). but when i use an variable, i can't get the content of the variable ! err = ILLOPS ...
4
votes
1answer
83 views

Are macros values, data types, identifiers, variables, constants, or …? [closed]

Macros exist in many programming languages, for example, C. A data type is a set of values with operations on the values. Are macros values, or data types? Are macros identifiers, variables, or ...
0
votes
1answer
61 views

Macro guard in Objective-C

I have noticed that many famous libraries written in Objective-C (eg. AFNetworking) use the macro guard inside their header files. Im aware that the #import directive, which works exactly like ...
1
vote
1answer
198 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
230 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
165 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
955 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
742 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
530 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 ...
3
votes
2answers
1k 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
613 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 ...
2
votes
2answers
439 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 ...
13
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
248 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 ...
17
votes
2answers
778 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
454 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
390 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
160 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 ...
18
votes
5answers
4k 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
888 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?