Do classes like UndefinedObject behave like a singleton in Pharo
Asked Answered
D

1

6

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.

Docilla answered 20/6, 2021 at 21:29 Comment(0)
S
8

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

Serrulate answered 20/6, 2021 at 21:47 Comment(1)
Thank you, I also wondered about true and false and you answered that as well.Docilla

© 2022 - 2024 — McMap. All rights reserved.