3 ms·
TBF that's pretty directly inherited from the Smalltalk ancestry: just like Smalltalk, Ruby simply doesn't have public (data) fields. Although it does provide s
by masklinn 7y ago
TBF that's pretty directly inherited from the Smalltalk ancestry: just like Smalltalk, Ruby simply doesn't have public (data) fields. Although it does provide shortcuts for automatically generating accessors which I don't think Smalltalk did / does.
Funnily enough, Self opted for the opposite tack of not having private data fields (although it does have readonly and read/write slots), but you can trivially swap "data" slots and "method" slots: http://handbook.selflanguage.org/2017.1/langref.html#construction-of-object-literals http://handbook.selflanguage.org/2017.1/langref.html#constru...
- scroot 7y ago> Although it does provide shortcuts for automatically generating accessors which I don't think Smalltalk did / does. Most Smalltalk browsers do actually offer this capability
- masklinn 7y agoThe tooling does provide that yes, as it does in e.g. Java. But Ruby does it without tooling, the feature is a runtime message to the class object.
- deleted 7y ago[deleted]