Hi Quentin Thanks a lot for the advise. I spoke to David on IRC he pretty mush told me the same. What that was missing and still is it's the -enumerateKeysAndObjectsUsingBlock: . It should normally be in the gnustep since it is in the OSX foundation framework but I did not found it. A part from the ETCollection+HOM is quite neat. I will use it as much as I can.
Cheers, -- Mathieu On Feb 27, 2012, at 8:29 PM, Quentin Mathé wrote: > Hi Matthieu, > > Le 27 févr. 2012 à 01:57, Mathieu SUEN a écrit : > >> Hi All >> >> I have added +map support to NSDictionary with the following method: >> - (NSArray*) mapValues: (id)aClosure; >> - (NSArray*) mapKeys: (id)aClosure; >> - (void) foreachKeysAndValues: (id)aClosure; >> - (void) foreachKeys: (id)aClosure; >> - (void) foreachValues: (id)aClosure; > > Instead of adding new API like -mapValues:, -mapKeys: etc. etc why not do as > below? > > dictionary values map: [ ] > > I would have the same reasoning for the last foreach methods. > >> If people founded valuable I can commit them. The wording in ST-80 would >> have been -collect: and -do: (-keysAndValuesDo: ..) but I have stick to the >> rules founded in NSArray+map.h > > > All Foundation collections support the HOM and block methods declared in > ETCollection+HOM.h (see EtoileFoundation/Headers). > I tend to use this API when I write Smalltalk code, rather than NSArray+map > which is something much older and hasn't been updated for a while. > > I could be wrong, but I thought that NSArray+map was present to support a > Smalltalk-80 API, in addition to the EtoileFoundation collection block API. > So I would say it's probably better to use the ST-80 wording rather than to > introduce a new one, given that we already have our own with > ETCollection+HOM.h. > > What would be nice is to change NSArray+map to be something more generic like > ETCollection+Smalltalk, that would add the common ST-80 collection methods to > the various Foundation collections, and leverage ETCollection+HOM as much as > possible. > > Cheers, > Quentin. > _______________________________________________ > Etoile-discuss mailing list > [email protected] > https://mail.gna.org/listinfo/etoile-discuss _______________________________________________ Etoile-discuss mailing list [email protected] https://mail.gna.org/listinfo/etoile-discuss
