wiki:FrequentlyAskedQuestions

Version 4 (modified by lpolzer, 6 years ago) (diff)

Added (SETF FIND-CLASS) item

Frequently Asked Questions about Clozure CL

Lisp

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  http://ccl.clozure.com/ccl-documentation.html#Additional-Open-Keywords in the manual for more details.

Defining class aliases with (SETF FIND-CLASS) doesn't define a matching type

The spec demands that only the proper name of a class produces a matching type definition.

See  http://clozure.com/pipermail/openmcl-devel/2009-May/009313.html for further explanation.

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