If !in is inconsistent because of bool/pointer, then so is !
Bill Baxter
wbaxter at gmail.com
Fri Feb 6 16:34:21 PST 2009
On Sat, Feb 7, 2009 at 8:54 AM, bearophile <bearophileHUGS at lycos.com> wrote:
> Rainer Deyke:
>> It's a question of consistent patterns versus special cases.
>
> You may think that for humans it's better to have a very orthogonal language, like for example Scheme.
> There's also a famous quote about this, "Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make additional features appear necessary." But in practice the large part of programmers work with languages like Java, C, C++, C#, Python, modern basic variants, etc despite they have much more restrictions compared to Scheme.
> This is a long thing to explain, and I don't have enough space in this tight post to explain it, but the short version is that removing "special cases" as allowing !+ makes the language worse, less easy to use, more bug-prone, and generally less good.
Note that D already has things like !>. But quoth the spec:
"For floating point comparison operators, (a !op b) is *NOT* the same
as !(a op b)."
[emphasis added]
But anyway I wholeheartedly agree that (a !in b) should exist and it
should be the same as !(a in b).
I think the principle of least surprise is generally a good one to
follow. And I think most people are surprised that (a !is b) means
!(a is b), while the same is not true of (a !in b).
--bb
More information about the Digitalmars-d
mailing list