[Dlang-internal] How about `and` and `or` like in Python?

Dennis dkorpel at gmail.com
Tue Oct 1 20:26:14 UTC 2019


On Tuesday, 1 October 2019 at 19:23:00 UTC, Murilo wrote:
> if you want minimalism then perhaps you should stick to C 
> instead, there you have very few ways of writing code. And 
> again, my idea would make it EASIER to read cause it would be 
> closer to natural language.

I used to program in a language (GML) that allowed both.
I always preferred `not`, `and` and `or` over the symbols `!`, 
`&&` and `||`.
That being said, adding the keywords when the symbols are already 
the standard is more harm than good.

It creates more bikeshedding / style-guides / arguments over 
which is the preferred way. There already is enough discussion 
about "options" for brace styles, tabs/spaces, 
snake_case/camelCase etc.

It also breaks existing code that uses these proposed keywords as 
identifiers.
For example in fluent asserts, this is no longer valid when `not` 
is a keyword: `x.should.not.be(null);`
Other examples:
- 
https://github.com/vibe-d/vibe.d/blob/c27f69dc9a17d969cbf394fa3b5947f8f7750ccf/web/vibe/web/auth.d#L342
- 
https://github.com/skoppe/spasm/blob/27717218bb64e10bab7a67511f87d4215bd2309c/source/spasm/ct.d#L868
- 
https://github.com/TurkeyMan/simd/blob/f04d4849dcd0b92b1d57b5a7974a9c686ff421e3/std/simd.d#L4516

Finally it opens the door for more "quality of life" synonyms, 
like `var` for `auto`, `boolean` for `bool`, angle brackets for 
template instantiations (yuck!), Java-like eponymous functions 
for constructors instead of `this()` etc.


More information about the Dlang-internal mailing list