Using ? for unary messages does not compose so well when you want to do
some logical conditions.
For example
self isClass? or: [ self isTrait? ] . It's readable, but probably you want
the ? just at the end of the sentence.

For ! one use case is to use it for factorial, like we do in Math. So 5 !
--> 120.
Also I don't know any good use case for ! as binary selector.

? has only one implementor in the Pharo image in some Url related code for
query parameters.

BTW, still using * for multiplication feels so 90's. :)

On Wed, Sep 11, 2019 at 4:10 AM ducasse <[email protected]> wrote:

>
>
> > On 11 Sep 2019, at 04:07, James Foster <[email protected]> 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"
> >       flag2 := anInteger isEven.      “better"
> >       flag3 := anInteger even?.       “how much better?”
> >       flag4 := #(1 2 3) includes?: 2. “how much better?”
>
> 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.
>
> > I’m not convinced that having another way to indicate a testing method
> will help if people still don’t name methods well.
> >
> > Also, can you give an example of where ! would clarify the meaning? Are
> you thinking of the following:
> >       myPoint x!: 3.
> >       myArray at: 1 put!: nil.
> > Those don’t seem to be much improved!
>
> Pay attention you cannot use ! as separator.
> For ! I do not care now.
>
> > I’m not arguing for “compatibility" or "staying in the past." I’m just
> trying to understand the benefit.
>
> The question ?
>
> >
> > Thanks,
> >
> > James
> >
> >> On Sep 10, 2019, at 1:14 PM, ducasse <[email protected]> wrote:
> >>
> >> I would love to retract ? and ! from the list of binary selectors.
> >> I’m super super frustrated that predicates cannot be easily
> identifiable.
> >>
> >> for example is
> >>      lineUpBlockBrackets an action or a testing method.
> >>
> >> I think that we are trapped in mistakes from the past.
> >> In racket and scheme and I guess ruby too we can use ? in the method
> and
> >> this change the game.
> >>
> >> self lineUpBlockBrackets?
> >>
> >> We have plenty of binary selector parts that are not used and think
> that
> >> it is frustrating.
> >>
> >> Let us check:
> >>
> >> Character specialCharacters
> >>
> >>      '+-/\*~<>=@,%|&?!·÷±×'
> >>
> >> +
> >> -
> >> /
> >> \
> >> ~
> >> <
> >>>
> >> =
> >> @
> >> ,
> >> &
> >> |
> >> %
> >>
> >> those are ok
> >>
> >> I have no idea what is · nor how to type it.
> >> ÷ looks from the past.
> >> ± so funny
> >> × no idea what it is and….
> >>
> >> Then we have two that could really improve our language
> >>      ? and !
> >>
> >> Do not tell me that there is a value in these selectors?
> >>
> >>
> >> (#(#+ #- #/ #\ #* #~ #< #> #= #@ #, #% #| #& #? #!) combinations
> >>      select: [ :each | each size = 3 and: [ each includesAnyOf: #(#?
> #!) ] ]) collect: [ :each | each first, each second, each third ]
> >>
> >> #(#'+-?' #'+-!' #'+/?' #'+/!' #'+\?' #'+\!' #'+*?' #'+*!' #'+~?' #'+~!'
> #'+<?' #'+<!' #'+>?' #'+>!' #'+=?' #'+=!' #'+@?' #'+@!' #'+,?' #'+,!'
> #'+%?' #'+%!' #'+|?' #'+|!' #'+&?' #'+&!' #'+?!' #'-/?' #'-/!' #'-\?'
> #'-\!' #'-*?' #'-*!' #'-~?' #'-~!' #'-<?' #'-<!' #'->?' #'->!' #'-=?'
> #'-=!' #'-@?' #'-@!' #'-,?' #'-,!' #'-%?' #'-%!' #'-|?' #'-|!' #'-&?'
> #'-&!' #'-?!' #'/\?' #'/\!' #'/*?' #'/*!' #'/~?' #'/~!' #'/<?' #'/<!'
> #'/>?' #'/>!' #'/=?' #'/=!' #'/@?' #'/@!' #'/,?' #'/,!' #'/%?' #'/%!'
> #'/|?' #'/|!' #'/&?' #'/&!' #'/?!' #'\*?' #'\*!' #'\~?' #'\~!' #'\<?'
> #'\<!' #'\>?' #'\>!' #'\=?' #'\=!' #'\@?' #'\@!' #'\,?' #'\,!' #'\%?'
> #'\%!' #'\|?' #'\|!' #'\&?' #'\&!' #'\?!' #'*~?' #'*~!' #'*<?' #'*<!'
> #'*>?' #'*>!' #'*=?' #'*=!' #'*@?' #'*@!' #'*,?' #'*,!' #'*%?' #'*%!'
> #'*|?' #'*|!' #'*&?' #'*&!' #'*?!' #'~<?' #'~<!' #'~>?' #'~>!' #'~=?'
> #'~=!' #'~@?' #'~@!' #'~,?' #'~,!' #'~%?' #'~%!' #'~|?' #'~|!' #'~&?'
> #'~&!' #'~?!' #'<>?' #'<>!' #'<=?' #'<=!' #'<@?' #'<@!' #'<,?' #'<,!'
> #'<%?' #'<%!' #'<|?' #'<|!' #'<&?' #'<&!' #'<?!' #'>=?' #'>=!' #'>@?'
> #'>@!' #'>,?' #'>,!' #'>%?' #'>%!' #'>|?' #'>|!' #'>&?' #'>&!' #'>?!'
> #'=@?' #'=@!' #'=,?' #'=,!' #'=%?' #'=%!' #'=|?' #'=|!' #'=&?' #'=&!'
> #'=?!' #'@,?' #'@,!' #'@%?' #'@%!' #'@|?' #'@|!' #'@&?' #'@&!' #'@?!'
> #',%?' #',%!' #',|?' #',|!' #',&?' #',&!' #',?!' #'%|?' #'%|!' #'%&?'
> #'%&!' #'%?!' #'|&?' #'|&!' #'|?!' #'&?!’)
> >>
> >> may be this one #&?! is useful for WTF!
> >>
> >> And because of that we sacrifice having nice method names!
> >> I really think that we should change that.
> >>
> >> S.
> >>
> >>
> >>
> >>
> >
> >
>
>
>
>

Reply via email to