[squeak-dev] Changeset: articles.1.cs

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sun Jan 19 22:03:40 UTC 2020


Hi all, please take a look at the following changeset. It eliminates a lot of duplication for printing a string with article, for example:


| title |
title := self class name.
aStream
nextPutAll: (title first isVowel ifTrue: ['an '] ifFalse: ['a ']);
nextPutAll: title.

<http://www.hpi.de/>

With this changeset, the example is rewritten much simpler as:

aStream nextPutAll: self class name asString withArticle.

(Additionally, this unification provides a possible hook, should we ever want to increase multilingual support. :))

I tried to find as many occurrences as possible (6), but even if we don't replace them all, I would like to propose to put the following three methods into Trunk (which are part of the changeset, of course):

String >> article
^ self first isVowel
ifTrue: ['an']
ifFalse: ['a']

String >> withArticle
^ self article , ' ' , self capitalized

Symbol >> withArticle
^ self article , self capitalized

Theoretically, we could also put them into the '*System-Support' category. Not sure about this.
Looking forward to your opinions :-)

Best,
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200119/8a07c24c/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: articles.1.cs
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200119/8a07c24c/attachment.ksh>


More information about the Squeak-dev mailing list