A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-topa.366.mcz ==================== Summary ==================== Name: Collections-topa.366 Author: topa Time: 16 June 2010, 3:34:47.932 pm UUID: 5491e7f9-bcc4-423a-a267-8853ca2eb9a3 Ancestors: Collections-ul.365 Provide #asCamelCase for Strings. May be usefull for natural language conversation or the like. =============== Diff against Collections-ul.365 =============== Item was added: + ----- Method: String>>asCamelCase (in category 'converting') ----- + asCamelCase + "Convert to CamelCase. Can be conveinient + in conjunction with #asLegalSelector + 'A man, a plan, a canal, panama' asCamelCase. + 'A man, a plan, a canal, panama' asCamelCase asLegalSelector. + 'Here 123should % be 6 the name6 of the method' asCamelCase. + 'Here 123should % be 6 the name6 of the method' asCamelCase asLegalSelector." + + ^ self class streamContents: [:stream | + self substrings do: [:sub | + stream nextPutAll: sub capitalized]]! |
Hi,
this little method may save some time if you need to generate readable method selectors frequently. Any objections against trunk inclusion? So Long, -Tobias Am 2010-06-16 um 13:34 schrieb [hidden email]: > > ==================== Summary ==================== > > Name: Collections-topa.366 > Author: topa > Time: 16 June 2010, 3:34:47.932 pm > UUID: 5491e7f9-bcc4-423a-a267-8853ca2eb9a3 > Ancestors: Collections-ul.365 > > Provide #asCamelCase for Strings. > May be usefull for natural language conversation or the like. > |
Isn't anybody interested in this?
I thought, camel case would be required more than occasionally ;) So Long, -tobias Am 2010-06-16 um 16:07 schrieb Tobias Pape: > Hi, > > this little method may save some time if you need to > generate readable method selectors frequently. > Any objections against trunk inclusion? > > So Long, > -Tobias > Am 2010-06-16 um 13:34 schrieb [hidden email]: >> >> ==================== Summary ==================== >> >> Name: Collections-topa.366 >> Author: topa >> Time: 16 June 2010, 3:34:47.932 pm >> UUID: 5491e7f9-bcc4-423a-a267-8853ca2eb9a3 >> Ancestors: Collections-ul.365 >> >> Provide #asCamelCase for Strings. >> May be usefull for natural language conversation or the like. >> > |
Seems of limited usefulness to me.
The only time I remember needing something similar was when I had to convert under_score_selectors to camelCase, and in that case your method wouldn't even have helped. - Bert - On 24.06.2010, at 21:23, Tobias Pape wrote: > Isn't anybody interested in this? > I thought, camel case would be required more > than occasionally ;) > > So Long, > -tobias > > Am 2010-06-16 um 16:07 schrieb Tobias Pape: > >> Hi, >> >> this little method may save some time if you need to >> generate readable method selectors frequently. >> Any objections against trunk inclusion? >> >> So Long, >> -Tobias >> Am 2010-06-16 um 13:34 schrieb [hidden email]: >>> >>> ==================== Summary ==================== >>> >>> Name: Collections-topa.366 >>> Author: topa >>> Time: 16 June 2010, 3:34:47.932 pm >>> UUID: 5491e7f9-bcc4-423a-a267-8853ca2eb9a3 >>> Ancestors: Collections-ul.365 >>> >>> Provide #asCamelCase for Strings. >>> May be usefull for natural language conversation or the like. |
Hi
Am 2010-06-24 um 21:50 schrieb Bert Freudenberg: > Seems of limited usefulness to me. > > The only time I remember needing something similar was when I had to convert under_score_selectors to camelCase, and in that case your method wouldn't even have helped. True. My usecase was converting a Given String to camelcase, as in: "prepare food for the winning team" => prepareFoodForTheWinnigTeam can be useful for DSLs So Long, -Tobias |
In reply to this post by Bert Freudenberg
It would make a fine community supported package, though, I think.
On Jun 24, 2010, at 12:50 PM, Bert Freudenberg <[hidden email]> wrote: > Seems of limited usefulness to me. > > The only time I remember needing something similar was when I had to convert under_score_selectors to camelCase, and in that case your method wouldn't even have helped. > > - Bert - > > On 24.06.2010, at 21:23, Tobias Pape wrote: > >> Isn't anybody interested in this? >> I thought, camel case would be required more >> than occasionally ;) >> >> So Long, >> -tobias >> >> Am 2010-06-16 um 16:07 schrieb Tobias Pape: >> >>> Hi, >>> >>> this little method may save some time if you need to >>> generate readable method selectors frequently. >>> Any objections against trunk inclusion? >>> >>> So Long, >>> -Tobias >>> Am 2010-06-16 um 13:34 schrieb [hidden email]: >>>> >>>> ==================== Summary ==================== >>>> >>>> Name: Collections-topa.366 >>>> Author: topa >>>> Time: 16 June 2010, 3:34:47.932 pm >>>> UUID: 5491e7f9-bcc4-423a-a267-8853ca2eb9a3 >>>> Ancestors: Collections-ul.365 >>>> >>>> Provide #asCamelCase for Strings. >>>> May be usefull for natural language conversation or the like. > > > |
In reply to this post by Tobias Pape
Sorry for the late reply, but an interesting aspect of this for me was
the idea of converting Smalltalk selectors or identifiers to and from normal written words. I have had reason to convert the other way, presenting a Maui user-interface that converts the selector name to words makes the UI's look conventional without forcing the Maui designer to go in and override every label. But converting from words to a selector or identifier, I have not needed yet. But I can see a potential use: for parsing human written words to generate code selector names... On Thu, Jun 24, 2010 at 4:04 PM, Tobias Pape <[hidden email]> wrote: > Hi > Am 2010-06-24 um 21:50 schrieb Bert Freudenberg: > >> Seems of limited usefulness to me. >> >> The only time I remember needing something similar was when I had to convert under_score_selectors to camelCase, and in that case your method wouldn't even have helped. > > True. > My usecase was converting a Given String > to camelcase, as in: > "prepare food for the winning team" => prepareFoodForTheWinnigTeam > > > can be useful for DSLs > > So Long, > -Tobias > |
Hi,
Am 2010-07-02 um 20:18 schrieb Chris Muller: > Sorry for the late reply, but an interesting aspect of this for me was > the idea of converting Smalltalk selectors or identifiers to and from > normal written words. > > I have had reason to convert the other way, presenting a Maui > user-interface that converts the selector name to words makes the UI's > look conventional without forcing the Maui designer to go in and > override every label. > Seaside provides this: String>>asCapitalizedPhrase > But converting from words to a selector or identifier, I have not > needed yet. But I can see a potential use: for parsing human written > words to generate code selector names... Thats exactly my application :) So Long, -Tobias |
Could we come to a conclusion on this, please?
Acceptance or rejection? --Hannes On 7/5/10, Tobias Pape <[hidden email]> wrote: > Hi, > > Am 2010-07-02 um 20:18 schrieb Chris Muller: > >> Sorry for the late reply, but an interesting aspect of this for me was >> the idea of converting Smalltalk selectors or identifiers to and from >> normal written words. >> >> I have had reason to convert the other way, presenting a Maui >> user-interface that converts the selector name to words makes the UI's >> look conventional without forcing the Maui designer to go in and >> override every label. >> > > Seaside provides this: String>>asCapitalizedPhrase > >> But converting from words to a selector or identifier, I have not >> needed yet. But I can see a potential use: for parsing human written >> words to generate code selector names... > > Thats exactly my application :) > > So Long, > -Tobias > > |
In reply to this post by Tobias Pape
I say accept. Even if there may not be many applications today that
would use it, It seems to encourages a high-bandwidth interface between humans and Squeak; which is something we've always been interested in. - Chris On Mon, Jul 5, 2010 at 3:07 AM, Tobias Pape <[hidden email]> wrote: > Hi, > > Am 2010-07-02 um 20:18 schrieb Chris Muller: > >> Sorry for the late reply, but an interesting aspect of this for me was >> the idea of converting Smalltalk selectors or identifiers to and from >> normal written words. >> >> I have had reason to convert the other way, presenting a Maui >> user-interface that converts the selector name to words makes the UI's >> look conventional without forcing the Maui designer to go in and >> override every label. >> > > Seaside provides this: String>>asCapitalizedPhrase > >> But converting from words to a selector or identifier, I have not >> needed yet. But I can see a potential use: for parsing human written >> words to generate code selector names... > > Thats exactly my application :) > > So Long, > -Tobias > > |
In reply to this post by Tobias Pape
I say include it. I use it to create dictionary keys from a head while importing delimited text files.
populateFrom: aReadStream delimitWith: delimiters labels: labelCollection | numberOfFields newEntry item | data := OrderedCollection new. labels := labelCollection collect: [ :each | each withBlanksTrimmed asCamelCase asSymbol ]. numberOfFields := labels size. [aReadStream atEnd] whileFalse: [ item := (aReadStream nextLine) subStrings: delimiters. newEntry := Dictionary new: numberOfFields. item size > numberOfFields ifTrue: [ self error: ['Number of data elements exeeds expected from labels']]. labels withIndexDo: [:label :index | newEntry at: label put: (item at: index ifAbsent: [nil]). ]. data add: newEntry. ]. |
In reply to this post by Bert Freudenberg
Two years later and I revise my stance on usefulness ;)
Merged into trunk. One issue down the road might be that Etoys has a method with the same selector, but it does not change the case of the first character. Also, it does not create a copy of the string if there is no space in it. And it only looks for spaces. I like the simplicity of Tobias' version though, which is why I committed that one. - Bert - On 24.06.2010, at 12:50, Bert Freudenberg <[hidden email]> wrote: > Seems of limited usefulness to me. > > The only time I remember needing something similar was when I had to convert under_score_selectors to camelCase, and in that case your method wouldn't even have helped. > > - Bert - > > On 24.06.2010, at 21:23, Tobias Pape wrote: > >> Isn't anybody interested in this? >> I thought, camel case would be required more >> than occasionally ;) >> >> So Long, >> -tobias >> >> Am 2010-06-16 um 16:07 schrieb Tobias Pape: >> >>> Hi, >>> >>> this little method may save some time if you need to >>> generate readable method selectors frequently. >>> Any objections against trunk inclusion? >>> >>> So Long, >>> -Tobias >>> Am 2010-06-16 um 13:34 schrieb [hidden email]: >>>> >>>> ==================== Summary ==================== >>>> >>>> Name: Collections-topa.366 >>>> Author: topa >>>> Time: 16 June 2010, 3:34:47.932 pm >>>> UUID: 5491e7f9-bcc4-423a-a267-8853ca2eb9a3 >>>> Ancestors: Collections-ul.365 >>>> >>>> Provide #asCamelCase for Strings. >>>> May be usefull for natural language conversation or the like. > > |
Free forum by Nabble | Edit this page |