On Wed, Mar 15, 2017 at 6:33 PM, Torsten Bergmann <[email protected]> wrote:

> According to https://en.wikipedia.org/wiki/Capitalization
>
> to "capitalize" is writing a word with its first letter as a capital
> letter (upper-case letter)
> AND THE REMAINING LETTERS IN LOWER CASE writing systems.
>
> So
>
>   'SOMETHING' capitalized
>
> currently returns "SOMETHING" in Pharo but should return "Something"
> according to the definition to end up with lowercase.
>

I think it would be reasonable to expect...
    self assert: 'something' capitalized
           equals: 'SOMETHING' capitalized

In ignorance of history, I'd call this a bug.
Maybe not for "frozen" Pharo 6, but not needing a deprecation, just a fix.

cheers -ben


> If we fix this I guess we would also align Pharo with other languages,
> like C# for example [1].
>
> Could be easily changed by replacing "copy" with "asLowercase" in
> #capitalized:
>
>  capitalized
>         "Return a copy with the first letter capitalized"
>         | cap |
>         self isEmpty ifTrue: [ ^self copy ].
>         cap := self asLowercase.
>         cap at: 1 put: (cap at: 1) asUppercase.
>         ^ cap
>
> Should we fix this? Do not know about any side effects...
>
>
> Note: a) Squeak has the same issue
>       b) it fits for #uncapitalized, see [2]
>       c) Dont know about ANSI standard or any other ST dialect
>
> Thx
> T.
>
>
> [1] https://github.com/srkirkland/Inflector/blob/master/Inflector.Tests/
> CapitalizeTests.cs
> [2] https://github.com/srkirkland/Inflector/blob/master/Inflector.Tests/
> UncapitalizeTests.cs
>
>

Reply via email to