Search code examples
smalltalkpharo

Do classes like UndefinedObject behave like a singleton in Pharo


I am learning Pharo and I want to understand if classes/objects like nil which belongs to UndifnedObject class have only 1 instance and act like a singleton, or is a new instance made every time we have a nil.


Solution

  • The symbol nil refers to the single instance of UndefinedObject. You will find the same for true and false (sole instances of True and False respectively).