On 1/6/2026 4:04 PM, Wolfgang Dann wrote:
But why are you saying first, temperature is an attribute of an object,
and then you are making it the object itself?
For me this looks counter intuitive.
I didn't say Temperature is an attribute of Object. I said that the
scale used for temperature is an attribute of temperature.
I didn't say anything about where Temperature lived. I just mentioned
deriving it from Number instead of Object.
But I think
Object()
temperature: number.
temperature.Celsius?: number
temperature.Fahrenheit?: number
would be more intuitive.
That way you could have myRoom: Object.
myRoom temperature.Celsius?
Temperature is a Number, so I made it a subclass of number. You can make
it a subclass of Object, but it would not really serve any additiona
benefit.
If you want a Room, then ask yourself: is temperature an attribute of a
Room or vise versa? I believe the former. So temperature is an attribute
of a room. It's a member. Room can be a subclass of Object and
Temperature would be an attribute, not a subclass, or room. If you want
the temperature of the room, you'd call (using pseudo code here)
something like: myRoom.temperature.asF() or myRoom.temperature.asC().