The Inbox: System-mt.1122.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: System-mt.1122.mcz

commits-2
A new version of System was added to project The Inbox:
http://source.squeak.org/inbox/System-mt.1122.mcz

==================== Summary ====================

Name: System-mt.1122
Author: mt
Time: 18 November 2019, 2:49:37.103051 pm
UUID: 9fc8f687-9772-7244-9a7b-e655b26e9f84
Ancestors: System-mt.1121

(Disclaimer: Just to get a throught out of my head.)

Proposal

Having #asSimpleSetter and #asSimpleGetter, add a convenient way to read/write objects having only key/value-pairs at hand. When processing some JSON data, for example. This API reads less "meta" than, for example, #perform: or #instVarAt: ...

Further reading:

Morph >> #setProperty:toValue:
Morph >> #valueOfProperty:
UserInterfaceTheme >> #set:to:
UserInterfaceTheme >> #get:
Dictionary >> #at:put:
Dictionary >> #at:
Object >> #instVarAt:put:
Object >> #instVarAt:
Object >> #instVarNamed:put:
Object >> #instVarNamed:

=============== Diff against System-mt.1121 ===============

Item was added:
+ ----- Method: Object>>get: (in category '*System-Support') -----
+ get: property
+ "Meta-programming to access object state."
+
+ ^ self perform: property asSimpleGetter!

Item was added:
+ ----- Method: Object>>set:to: (in category '*System-Support') -----
+ set: property to: value
+ "Meta-programming to change object state."
+
+ self perform: property asSimpleSetter with: value.!