Skip to content

Phep: Introduce a non misleading not equals selector #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

demarey
Copy link
Contributor

@demarey demarey commented Dec 21, 2022

No description provided.

@estebanlm
Copy link
Member

While I am not against (my pharo-motto by excellence is "do not be alien just for the sake of it", I do not see the real gain here and it will be probably just adding confusion to the equation.
~= is just misleading if you are expecting mathematical notation (and you are not comfortable with Pharo). But then, people will ask why don't we have mathematical precedence... and like that.
So, I am not sure what to think about this, I would as more the opinion of language experts like @Ducasse or @MarcusDenker :)

@estebanlm
Copy link
Member

estebanlm commented Dec 23, 2022

by the way did you start the discussion process as required by https://github.com/pharo-project/pheps/blob/main/phep-0001.md ?

GitHub
Pharo Enhancement Proposals. Contribute to pharo-project/pheps development by creating an account on GitHub.

@demarey
Copy link
Contributor Author

demarey commented Dec 23, 2022

by the way did you start the discussion process as required by https://github.com/pharo-project/pheps/blob/main/phep-0001.md ?

I just sent the message

GitHub
Pharo Enhancement Proposals. Contribute to pharo-project/pheps development by creating an account on GitHub.

@privat
Copy link
Contributor

privat commented Feb 10, 2023

I have no pro nor con feeling about this.

~= (and ~~) are weird as there are not a lot of languages with this syntax (only Lua and Matlab?) so most people have to learn it and be used to it (so there is a cost for Smalltalk newcomers), and weirder if you have some knowledge of Ruby, Perl or Awk for instance (since ~, ~= or !~ are related to regular expression), but it is an oddity among a lot of oddities (like operator precedence as @estebanlm wrote) and it's the cost of leaning a new language (new syntax, new class names, new std class hierarchy, new libraries, new paradigms, etc.)

Note that different languages have different syntax for "not equal", e.g. <> or /= or !x.equals(y) or -ne etc. — I let people guess the languages here :p

However, != and !== are unused operators in Pharo, so it's tempting to just do the switch (and be less odd).

An alternative proposal could be to add a Rule about != and !== and so that the user have a visual feedback when writing the wrong operator syntax (and an autofix to use the right tildeful one). I think there is such a rule about True and False to undercase them that targets Python programmers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants