[squeak-dev] The Inbox: Collections-ct.858.mcz

Chris Muller asqueaker at gmail.com
Mon Oct 14 20:36:38 UTC 2019


-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 <commits at source.squeak.org> wrote:

> 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!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20191014/7a0802cc/attachment.html>


More information about the Squeak-dev mailing list