Nu Class Reference

NuReference

The Nu object wrapper.

Superclass: NSObject
Declared in: objc/reference.h

The NuReference class provides a wrapper for pointers to Objective-C objects. NuReference objects are used in the Nu language to capture arguments that are returned by value from Objective-C methods. For example, the following Nu method uses a NuReference to capture a returned-by-reference NSError:

(imethod (id) save is
  (set perror ((NuReference alloc) init))
  (set result ((self managedObjectContext) save:perror))
  (unless result
    (NSLog "error: #{((perror value) localizedDescription)}"))
  result)

Methods

- (id *) pointerToReferencedObject
Get a pointer to the referenced object. Used by the bridge to Objective-C to convert NuReference objects to pointers. Don't call this from Nu.

in objc/reference.h

- (void) retainReferencedObject
Retain the referenced object. Used by the bridge to Objective-C to retain values returned by reference.

in objc/reference.h

- (void) setPointer: (id *) pointer
Set the pointer for a reference. Used by the bridge to create NuReference objects from pointers. Don't call this from Nu.

in objc/reference.h

- (void) setValue: (id) value
Set the value of the referenced object.

in objc/reference.h

- (id) value
Get the value of the referenced object.

in objc/reference.h