A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-ct.858.mcz ==================== Summary ==================== Name: Collections-ct.858 Author: ct Time: 13 October 2019, 10:33:55.310932 pm UUID: 80a9daa4-d11d-554c-8530-f4d5a1a70c8f Ancestors: Collections-pre.857 Adds #withFirstCharacterUpshifted analogously to #withFirstCharacterDownshifted =============== Diff against Collections-pre.857 =============== Item was changed: ----- Method: String>>withFirstCharacterDownshifted (in category 'converting') ----- withFirstCharacterDownshifted - "Return a copy with the first letter downShifted" | answer | - self ifEmpty: [^ self copy]. answer := self copy. answer at: 1 put: (answer at: 1) asLowercase. + ^ answer! - ^ answer. ! Item was added: + ----- Method: String>>withFirstCharacterUpshifted (in category 'converting') ----- + withFirstCharacterUpshifted + + | answer | + self ifEmpty: [^ self copy]. + answer := self copy. + answer at: 1 put: (answer at: 1) asUppercase. + ^ answer! Item was changed: ----- Method: Symbol>>withFirstCharacterDownshifted (in category 'converting') ----- withFirstCharacterDownshifted + "Answer an object like the receiver but with first character downshifted if necessary" - "Answer an object like the receiver but with first character downshifted if necesary" + ^self asString withFirstCharacterDownshifted asSymbol! - ^self asString withFirstCharacterDownshifted asSymbol.! Item was added: + ----- Method: Symbol>>withFirstCharacterUpshifted (in category 'converting') ----- + withFirstCharacterUpshifted + "Answer an object like the receiver but with first character upshifted if necessary" + + ^self asString withFirstCharacterUpshifted asSymbol! |
-1. Using the Method Finder, enter 'hello'. 'Hello' to see we already have #capitalized to do that. Before introducing new API, always research existing nomenclature's. Uncapitalization is not a common use-case, but if you want to introduce it into Squeak, I'd suggest #uncapitalized instead of two new methods named "Upshifted" and "Downshifted". Those words describe the "procedure for obtaining a capital letter from a keyboard" (except "Downshifted," which only describes a car with a manual transmission, ready to burn rubber :) ). By contrast, the #capitalized API describes the nature of the object itself. Best, Chris On Sun, Oct 13, 2019 at 3:34 PM <[hidden email]> wrote: A new version of Collections was added to project The Inbox: |
Hmm... given that I always remember #withFirstCharacterDownshifted but not #capitalized ... I think there might be something missing here. :-) Yes, if we would add #withFirstCharacterUpshifted, it should just call #capitalized directly. 'hello world' capitalized does not yield 'Hello World' but only 'Hello world' ... because it says "...writing a word with its first letter as a capital letter..." so 'hello world' has two words in it. So, #withFirstCharacterDownshifted refers to the string full of characters. #capitalized actually should refer to words. Anyway, I think that #withFirstCharacterUpshifted cannot hurt. :-) +0.5 Best, Marcel
|
On Tue, Oct 15, 2019 at 1:42 AM Marcel Taeumel <[hidden email]> wrote:
I was talking about nomenclature, not implementation.
It hurts by overloading the API with an unnecessary synonym. We already have the words "upperCase" and "lowerCase" and "capitalized". Please, don't introduce "Shifted" too, it's not mentioned anywhere on that Wikipedia page, and not even Google has a definition for "Upshifted", only "Upshift" -- and it refers to the automotive context I mentioned. If you feel strongly this belongs in trunk (I don't), then may we at least call it #withFirstCharacterCapitalized? Best, Chris
|
> Please, don't introduce "Shifted" too It has been already there for a while: #withFirstCharacterDown*shifted*. Also, we can shift a menu to show different items. There is the [shift] key to write upper-case letters. And so on. It's already there. Nothing new. :-) > If you feel strongly this belongs in trunk (I don't), then may we at least call it #withFirstCharacterCapitalized? No strong feelings. :-) I do not understand your argument "nomenclature vs. implementation". Looking at the definition of "Capitalization" in Wikipedia, I think that Squeak's implementation of #capitalized is not correct, which renders your argument of using #capitalized instead of adding #withFirstCharacterUpshifted void. At the level of words, #capitalized has no counterpart that works in terms of "words" and "letters". A "character" can also be a number. At the level of strings, #withFirstCharacterDownshifted has no counterpart that works in terms of "sub-strings" and "characters". Hmm... does this make more sense now? Anyway, I also think that the word "downshifted" is strange, but so is "upshifted". :-) Best, Marcel
|
...then again, you cannot "down-shift" all characters... hmpf ... Best, Marcel
|
In reply to this post by marcel.taeumel
If I look at senders of #withFirstCharacterDownshifted, and senders
of #capitalized, I so not see any usages of #capitalized that would be more clear or easier to understand if renamed. The usages also seem to be logically related to string operations and not to keyboard actions, so the "shifted" terminology would seem awkward to me (*). So I agree with Chris, this change is not needed. Dave (*) The name "withFirstCharacterDownshifted" also seems awkward to me for the same reason, but its intent is clear, and the name has not bothered anyone for the last 15 years. On Wed, Oct 16, 2019 at 09:35:01AM +0200, Marcel Taeumel wrote: > >??Please, don't introduce "Shifted" too > > It has been already there for a while: #withFirstCharacterDown*shifted*. Also, we can shift a menu to show different items. There is the [shift] key to write upper-case letters. And so on. It's already there. Nothing new. :-) > > > If you feel strongly this belongs in trunk (I don't), then may we at least call it #withFirstCharacterCapitalized? > > No strong feelings. :-) I do not understand your argument "nomenclature vs. implementation". Looking at the definition of "Capitalization" in Wikipedia, I think that Squeak's implementation of #capitalized is not correct, which renders your argument of using #capitalized instead of adding #withFirstCharacterUpshifted void. > > At the level of words, #capitalized has no counterpart that works in terms of "words" and "letters". A "character" can also be a number. > > At the level of strings, #withFirstCharacterDownshifted has no counterpart that works in terms of "sub-strings" and "characters". > > Hmm... does this make more sense now? Anyway, I also think that the word "downshifted" is strange, but so is "upshifted". :-) > > Best, > Marcel > > Am 16.10.2019 04:48:35 schrieb Chris Muller <[hidden email]>: > On Tue, Oct 15, 2019 at 1:42 AM Marcel Taeumel <[hidden email] [mailto:[hidden email]]> wrote: > > Hmm... given that I always remember #withFirstCharacterDownshifted but not #capitalized ... I think there might be something missing here. :-) > > Yes, if we would add #withFirstCharacterUpshifted, it should just call #capitalized directly. > > Well, looking at Wikipedia (https://en.wikipedia.org/wiki/Capitalization [https://en.wikipedia.org/wiki/Capitalization]), I wonder why?? > > 'hello world' capitalized > > does not yield > > 'Hello World' > > but only > > 'Hello world' > > ... because it says "...writing a word with its first letter [https://en.wikipedia.org/wiki/Letter_(alphabet)] as a capital letter..." so 'hello world' has two words in it. > > So, #withFirstCharacterDownshifted refers to the string full of characters. #capitalized actually should refer to words. > > I was talking about nomenclature, not implementation. > ?? > > > Anyway, I think that #withFirstCharacterUpshifted cannot hurt. :-) > > It hurts by overloading the API with an unnecessary synonym.?? We already have the words "upperCase" and "lowerCase" and "capitalized".?? Please, don't introduce "Shifted" too, it's not mentioned anywhere on that Wikipedia page, and not even Google has a definition for "Upshifted", only "Upshift" -- and it refers to the automotive context I mentioned. > > If you feel strongly this belongs in trunk (I don't), then may we at least call it #withFirstCharacterCapitalized? > > Best, > ?? Chris > > ?? > > +0.5 > > Best, > Marcel > Am 14.10.2019 22:37:25 schrieb Chris Muller <[hidden email] [mailto:[hidden email]]>: > -1. > > Using the Method Finder, enter > > ?? ?? ??'hello'.?? 'Hello' > > to see we already have #capitalized to do that. > > Before introducing new API, always research existing nomenclature's.?? Uncapitalization is not a common use-case, but if you want to introduce it into Squeak, I'd suggest #uncapitalized instead of two new methods named "Upshifted" and "Downshifted".?? Those words describe the "procedure for obtaining a capital letter from a keyboard" (except "Downshifted," which only describes a car with a manual transmission, ready to burn rubber?? :)?? ).?? By contrast, the #capitalized API describes the nature of the object itself. > > Best, > ?? Chris > > > On Sun, Oct 13, 2019 at 3:34 PM <[hidden email] [mailto:[hidden email]]> wrote: > > A new version of Collections was added to project The Inbox: > http://source.squeak.org/inbox/Collections-ct.858.mcz [http://source.squeak.org/inbox/Collections-ct.858.mcz] > > ==================== Summary ==================== > > Name: Collections-ct.858 > Author: ct > Time: 13 October 2019, 10:33:55.310932 pm > UUID: 80a9daa4-d11d-554c-8530-f4d5a1a70c8f > Ancestors: Collections-pre.857 > > Adds #withFirstCharacterUpshifted analogously to #withFirstCharacterDownshifted > > =============== Diff against Collections-pre.857 =============== > > Item was changed: > ?? ----- Method: String>>withFirstCharacterDownshifted (in category 'converting') ----- > ?? withFirstCharacterDownshifted > -?? ?? ?? ??"Return a copy with the first letter downShifted" > > ?? ?? ?? ?? | answer | > -?? ?? ?? ?? > ?? ?? ?? ?? self ifEmpty: [^ self copy]. > ?? ?? ?? ?? answer := self copy. > ?? ?? ?? ?? answer at: 1 put: (answer at: 1) asLowercase. > +?? ?? ?? ??^ answer! > -?? ?? ?? ??^ answer. ! > > Item was added: > + ----- Method: String>>withFirstCharacterUpshifted (in category 'converting') ----- > + withFirstCharacterUpshifted > + > +?? ?? ?? ??| answer | > +?? ?? ?? ??self ifEmpty: [^ self copy]. > +?? ?? ?? ??answer := self copy. > +?? ?? ?? ??answer at: 1 put: (answer at: 1) asUppercase. > +?? ?? ?? ??^ answer! > > Item was changed: > ?? ----- Method: Symbol>>withFirstCharacterDownshifted (in category 'converting') ----- > ?? withFirstCharacterDownshifted > +?? ?? ?? ??"Answer an object like the receiver but with first character downshifted if necessary" > -?? ?? ?? ??"Answer an object like the receiver but with first character downshifted if necesary" > > +?? ?? ?? ??^self asString withFirstCharacterDownshifted asSymbol! > -?? ?? ?? ??^self asString withFirstCharacterDownshifted asSymbol.! > > Item was added: > + ----- Method: Symbol>>withFirstCharacterUpshifted (in category 'converting') ----- > + withFirstCharacterUpshifted > +?? ?? ?? ??"Answer an object like the receiver but with first character upshifted if necessary" > + > +?? ?? ?? ??^self asString withFirstCharacterUpshifted asSymbol! > > > |
Free forum by Nabble | Edit this page |