[squeak-dev] The Inbox: Collections-CW.640.mcz

Bert Freudenberg bert at freudenbergs.de
Thu Apr 14 08:10:25 UTC 2016


On 13.04.2016, at 13:13, commits at source.squeak.org wrote:
> 
> A new version of Collections was added to project The Inbox:
> http://source.squeak.org/inbox/Collections-CW.640.mcz
> 
> ==================== Summary ====================
> 
> Name: Collections-CW.640
> UUID: a0706e52-62c7-4ec4-b22b-6d99aa062158
> Ancestors: Collections-cmm.639
> 
> constantNameFor: handles all untypeable characters
> 
> =============== Diff against Collections-cmm.639 ===============
> 
> Item was changed:
>  ----- Method: Character class>>constantNames (in category 'private') -----
>  constantNames
> + 
> + 	^ self class organization listAtCategoryNamed: 'accessing untypeable characters'
> + !
> - 	^ #( backspace cr delete escape lf null newPage space tab ).!

Not a good idea. The class organization is informational only and should not be used to affect behavior. E.g. it gets zapped when abandoning sources (to deploy a minimal system) and after that things would break.

We might use something like

names := Set new.
Character class selectorsAndMethodsDo: [:sel :m |
	(m numArgs = 0 and: [(m at: m initialPC+ 2) = 202])
		ifTrue: [names add: sel]].
names

... but if so then we’d better add a test that it does the right thing because it looks a bit fragile.

If we really wanted a robust enumeration of selectors then it seems best to add a pragma to each of the methods, e.g. <namedConstant>, and filter methods for that.

But IMHO the old way of explicitly listing the constant names in a literal array is the simplest option, and good enough.

- Bert -



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4207 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160414/d4c084dd/smime.bin


More information about the Squeak-dev mailing list