modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
22.79k stars 2.57k forks source link

[Feature Request] Consistent naming of Traits using Gradable Adjectives #3156

Open RichardCoppin opened 2 months ago

RichardCoppin commented 2 months ago

Review Mojo's priorities

What is your request?

Looking at the traits of many of the structures: Defaultable, Movable, Copyable, Intable, Boolable, 'Representable', etc

The pattern has already be set up, and the names of these traits are all consistent: They are all 'gradable adjectives'. Although some of them are potentially not proper English words, they can be guessed.

Yet, then we have the traits of Sized and CollectionElement. Honestly, these are dissonant!

Particularly, in the case where there are two very appropriate adjectives Measurable and Collectable which could be used in their place. Measurable (being able to be measured) is, in the context of its use, better than Sizable (being of a considerable size).

Even traits like Indexer and KeyElement could be renamed to Indexable and Keyable respectively. Arguably they fit the context less as they are the reverse of their English definition. The other alternative is to use the term Indexing and Keying, which fit the pattern of using adjectives (participle adjectives in this case). Yet even here the difference can be motivated, in the way they are used. Both the indexing trait and the keying trait are such that are applied to other things.

Lastly we have traits CeilDivable and CeilDivableRaising, can they not just be CeilDivisable and CeilDivisableRaising?

What is your motivation for this change?

The pattern of the trait naming convention has already been set up. It shows to someone coming into the language that the domain has been carefully considered, and honestly the pattern is pleasing.

Dissonance is counter to that. It tends to give the impression that the domain is arbitrarily configures. It can also extricate us from being in the flow.

We like patterns, we don't like anti-patterns.

Any other details?

None

martinvuyk commented 1 month ago

Hi, have a look at the discussion in #2924 and add your ideas there and close this issue as it is a dup of that