Nu Class Reference

NuMacro_0

The Nu implementation of macros.

Superclass: NSObject
Declared in: objc/Nu.h

Macros allow Nu programmers to arbitrarily extend the Nu language.

In Nu programs, macros are defined with the macro operator.

Macros are like functions, but with two important differences:

First, macro arguments are not evaluated before the macro is called. It is up to the macro implementation to decide whether and how many times to evaluate each argument. When a Nu macro is evaluated, the margs name is defined and is bound to a list of the arguments of the macro.

Second, macro evaluation occurs in the context of the caller. This means that a macro has access to all names defined in the code that calls it, and that any name assignments made in a macro will affect the names in the calling code. To avoid unintentional name conflicts, any names in a macro body that begin with a double underscore ("__") are replaced with automatically-generated symbols that are guaranteed to be unique. In Lisp terminology, these generated symbols are called "gensyms".

Methods

- (NSString *) stringValue
Get a string representation of a macro.

in objc/Nu.h

- (NSSet *) gensyms
Get any gensyms in a macro.

in objc/Nu.h

- (NuCell *) body
Get the body of a macro.

in objc/Nu.h

- (NSString *) name
Get the name of a macro.

in objc/Nu.h