PsymNilSafe:
Filter:
Classes (extension) | Libraries > miSCellaneous > Other patterns

PsymNilSafe : Psym : FilterPattern : Pattern : AbstractFunction : Object
ExtensionExtension

Psym variant that avoids hangs if all referenced patterns return nil

Description

This adapts an idea of James Harkins' PnNilSafe (ddwPatterns quark) for Psym. If all patterns in the Dictinonary return nil, then Psym's embedInStream can produce an infinite loop, as it never yields. PnNilSafe can't be wrapped around Psym, but the check with logical time can be built into Psym itself. The wrapping into PsymNilSafe can shortly be written by applying Pattern: -symplay instead of Pattern: -play. See PLx and live coding with Strings for more examples.

Class Methods

PsymNilSafe.new(pattern, dict, maxNull: 128)

Creates a new PsymNilSafe object. pattern expects a pattern of Symbols, dict the lookup dictionary and defaults to the current Environment. maxNull is the number of events with delta = 0 after which PsymNilSafe's method 'embedInStream' yields and thus stops a potentially endless loop. maxNull defaults to 128.

Inherited class methods

Instance Methods

.maxNull

.maxNull = value

Getter and setter for PsymNilSafe's variable maxNull.

Inherited instance methods

Undocumented instance methods

.embedInStream(inval)

Example