Crazy idea inspired by Spanish:��

��even?

On Sat, Sep 14, 2019 at 04:38 ducasse <stepharo@netcourrier.com> wrote:


On 13 Sep 2019, at 20:52, Tim Mackinnon <tim@testit.works> wrote:


I agree with Ben���s reaction below , however the point that ? ! could be repurposed for something if they weren���t special characters is a good one. Maybe there are other usages we are missing, ��and that���s the point I guess.

Exactly.��
I think that it would be nice to think a bit.
I like the idea that I do not have to read the code to understand if a method is a predicate.

odd?
even?

Stef


Tim

Sent from my iPhone

On 13 Sep 2019, at 17:41, Ben Coman <btc@openinworld.com> wrote:



On Wed, 11 Sep 2019 at 15:10, ducasse <stepharo@netcourrier.com> wrote:


> On 11 Sep 2019, at 04:07, James Foster <Smalltalk@JGFoster.net> wrote:
>
> Would use of ? and ! in unary/keyword selectors be convention or somehow required? If simply convention, then we should start with renaming testing methods to be named is* or has*.
>�� �� �� ��flag1 := anInteger even.�� �� �� �� �� �� �� �� ���not good"

Agreed.�� That could "almost" be construed�� as converting a 3 to a 2 or 4.
��

>�� �� �� ��flag2 := anInteger isEven.�� �� �� ���better"

Agreed. It reads well.
��

>�� �� �� ��flag3 := anInteger even?.�� �� �� �����how much better?���

For me, this doesn't read as well as flag2, but even though there is some redundancy, for me a combination reads well...
�� �� ��flag3a := anInteger isEven?
Perhaps if "?"==>Boolean was a strong convention then there could be a check when the value is returned rather than when it is used (or would that complicate other things?)��
��

>�� �� �� ��flag4 := #(1 2 3) includes?: 2. ���how much better?���

My first impression is "yuck!", but then I think... "maybe" if there was a definite benefit (i.e. optimization) from strong guarantees about the return value being Boolean.

��

I think that I would use ? mainly for unary message

Now I���m sure that if you look carefully some people use

�� �� �� �� include
�� �� �� �� �� �� �� �� for the action
�� �� �� �� includes
�� �� �� �� �� �� �� �� for the tests

I took include as an example and this is super not intention revealing.

>> lineUpBlockBrackets

�� �� �� �� lineUpBlockBrackets?
�� �� �� �� Now I will rewrite them all as shouldLineUpBlockBrackets or isLineUpBlockBrackets and to me for unary message ? makes it a lot better.

btw, some alternatives...����
�� �� doBlockBracketsLineUp�� ��- reads well but "do" is already a loaded word
�� �� areBlockBracketsLinedUp - reads well with the past-tense phrasing

cheers -ben

--
Christopher Fuhrman, P.Eng., PhD
Professeur au D��partement de g��nie logiciel et des technologies de l'information
��TS (��cole de technologie sup��rieure)

http://profs.etsmtl.ca/cfuhrman
+1 514 396 8638
L'��TS est une constituante de l'Universit�� du Qu��bec