Version 3 (modified by rme, 11 years ago) (diff)

entry for thread-private streams

Frequently Asked Questions about Clozure CL


RANDOM always returns the the same sequence of numbers.

In Clozure CL, the initial random state in a thread is always the same. This sometimes shows up in SLIME when people use something like C-c C-r on a form involving RANDOM and are surprised to see the same result every time.

Stream #<xyz> is private to #<some process>

By default, streams are private to the thread that created them. This restriction eliminates a lot of locking overhead on stream operations, and makes streams faster. When creating streams that will be used by multiple threads, specify :sharing :lock when calling OPEN or MAKE-SOCKET.

See in the manual for more details.

Objective-C Bridge

The #$ reader macro doesn't find certain Cocoa constants.

Some of the "constants" that Cocoa uses are not numeric constants at all, but are actually variables that refer to instances of NSString.

For instance, NSTitledWindowMask is an actual numeric constant, so #$NSTitledWindowMask => 1. On the other hand, NSFontAttributeName is a variable which refers to an NSString. In cases like this, use the #& reader macro: #&NSFontAttributeName =>#<NS-MUTABLE-STRING "NSFont" (#x7FFF701D8410)>.