[Pharo4] Slots: ExampleSlotWithDefaultValue
Hi, Todays small improvement: ExampleSlotWithDefaultValue now allows to set the default in the definition (it was before just hard coding a value). e.g. Object subclass: #GG slots: { #gg => ExampleSlotWithDefaultValue default: 5 } classVariables: { } category: âPlayGround' When inspecting GG new â> the slot is initialised to 5. https://pharo.fogbugz.com/f/cases/14991/ExampleSlotWithDefaultValue-allow-de... - Slot: storeOn: calls printOn: - PropertyBaseSlot: use mangeled name: #_propertyBaseSlot - ExampleSlotWithDefaultValue: set default in definition Marcus
:) look more and more like CLOS :) now a question: what do you accept as value: (literals or expressions). I have the impression that literals are better because no runtime needed. Stef
Hi,
Todays small improvement:
ExampleSlotWithDefaultValue now allows to set the default in the definition (it was before just hard coding a value).
e.g.
Object subclass: #GG slots: { #gg => ExampleSlotWithDefaultValue default: 5 } classVariables: { } category: âPlayGround'
When inspecting
GG new
â> the slot is initialised to 5.
https://pharo.fogbugz.com/f/cases/14991/ExampleSlotWithDefaultValue-allow-de... - Slot: storeOn: calls printOn: - PropertyBaseSlot: use mangeled name: #_propertyBaseSlot - ExampleSlotWithDefaultValue: set default in definition
Marcus
On 27 Feb 2015, at 16:01, stepharo <stepharo@free.fr> wrote:
:) look more and more like CLOS :)
now a question: what do you accept as value: (literals or expressions). I have the impression that literals are better because no runtime needed.
right now it is very simplistic: when you accept, it evaluates the definition. When you browse it, it prints it. So it accepts literals. Yes, this is best. For expressions, the slot could use Blocks⦠but I do not like the idea. Marcus
Le 27/2/15 16:07, Marcus Denker a écrit :
On 27 Feb 2015, at 16:01, stepharo <stepharo@free.fr> wrote:
:) look more and more like CLOS :)
now a question: what do you accept as value: (literals or expressions). I have the impression that literals are better because no runtime needed.
right now it is very simplistic: when you accept, it evaluates the definition. When you browse it, it prints it.
So it accepts literals.
Yes, this is best. For expressions, the slot could use Blocks⦠but I do not like the idea.
Me too (but this is just a gut feeling) and it corresponds literal initializers in self. So we could imagine that we can easily serialize slots and pass them around :)
Marcus
stepharo wrote
I have the impression that literals are better because no runtime needed.
Except it eliminates a common-sounding case like: Object subclass: #GG slots: { #creationTimestamp => ExampleSlotWithDefaultValue default: DateAndTime now } classVariables: { } category: âPlayGround' ----- Cheers, Sean -- View this message in context: http://forum.world.st/Pharo4-Slots-ExampleSlotWithDefaultValue-tp4807635p480... Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (3)
-
Marcus Denker -
Sean P. DeNigris -
stepharo