View mode: basic / threaded / horizontal-split · Log in · Help
April 04, 2006
not operator operator..
I really really hate the !in, !is syntax.   I think a lot of other 
people do too. I propose that the word not, become an operator on 
operators.  For example:

Foo not is null
Foo not in Bar

This not keyword will only function when it is part of these expressions:

EqualExpression
RelExpression
InExpression

As a consequence the following would be valid:

Foo not == Bar
Foo not <= Bar

-S.
April 04, 2006
Re: not operator operator..
S. Chancellor wrote:
> I really really hate the !in, !is syntax.   I think a lot of other 
> people do too. I propose that the word not, become an operator on 
> operators.  For example:
> 
> Foo not is null
> Foo not in Bar
> 
> This not keyword will only function when it is part of these expressions:
> 
> EqualExpression
> RelExpression
> InExpression
> 
> As a consequence the following would be valid:
> 
> Foo not == Bar
> Foo not <= Bar
> 
> -S.
> 

I don't hate !is and !in, but if they were to change, I would suggest a 
more succinct syntax:

!is => not
!in => out
April 04, 2006
Re: not operator operator..
S. Chancellor wrote:
> I really really hate the !in, !is syntax.   I think a lot of other 
> people do too. I propose that the word not, become an operator on 
> operators.  For example:
> 
> Foo not is null
> Foo not in Bar
> 
> This not keyword will only function when it is part of these expressions:
> 
> EqualExpression
> RelExpression
> InExpression
> 
> As a consequence the following would be valid:
> 
> Foo not == Bar
> Foo not <= Bar


D !is BASIC

;-)
April 04, 2006
Re: not operator operator..
On Mon, 3 Apr 2006 20:34:24 -0700, S. Chancellor  
<dnewsgr@mephit.kicks-ass.org> wrote:
> I really really hate the !in, !is syntax.   I think a lot of other  
> people do too.

I like !in and !is.

> I propose that the word not, become an operator on operators.

I don't like it.

- It's more typing.
- "!" already means "not" to me (in this context).
- I read "!is" as "not is" and can't see an advantage to having "is not"  
instead. (I don't see why it has to be correct english)

Regan
April 04, 2006
Re: not operator operator..
"S. Chancellor" <dnewsgr@mephit.kicks-ass.org> wrote in message 
news:e0spgo$2jvr$1@digitaldaemon.com...
> Foo not is null
> Foo not in Bar

Ew.

> Foo not == Bar
> Foo not <= Bar

How about

Foo not equal to Bar
Foo not less than or equal to Bar

While you're at it?  ;)

Terseness is both a curse and a blessing of C-style syntax...
April 04, 2006
Re: not operator operator..
On Tue, 4 Apr 2006 01:59:59 -0400, Jarrett Billingsley wrote:

> Terseness is both a curse and a blessing of C-style syntax...

A language that I use daily (Progress 4GL) not only has the standard
operators defined in terms of symbol characters etc... is also has them
defined as ...

eq
ne
gt
lt
ge
le

so one can write code such as 

  for each Customer where balance gt 1000

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
4/04/2006 4:10:11 PM
April 04, 2006
Re: not operator operator..
Sorry, I don't agree. != has been in C for ages and any C programmer
should therefore understand !in or !is.

Unlike in natural language text, source code does ! become more readable
when using words. It may slightly help the newbie, but it will get in
the way for everyday use.

The problem of Perl, for example, is not that it uses cryptic operators,
but that it uses too many, so that it takes a long time to know all of
them. the die-hard Perl users love that because it really improves
productivity, but any outsider is left in the rain.

For D, it is important to find the right measure which lies somewhere in
between Perl and Cobol:
http://www.csis.ul.ie/COBOL/Exercises/Exm-AcmeStockReorder/Prg-AcmeStockReorder.htm
April 04, 2006
Re: not operator operator..
S. Chancellor wrote:

> I really really hate the !in, !is syntax.   I think a lot of other 
> people do too.

I do too. Hmm, does "!in" even exist ?

> I propose that the word not, become an operator on 
> operators.  For example:
> 
> Foo not is null
> Foo not in Bar

But this just looks just as horrible ?

Back in the day it was suggested that the Foo !== null syntax
was changed into !(Foo is null), so I guess you can use that ?

I just gave up and converted it to !Foo... Boolean be damned.

--anders
April 04, 2006
Re: not operator operator..
Derek Parnell wrote:

> A language that I use daily (Progress 4GL) not only has the standard
> operators defined in terms of symbol characters etc... is also has them
> defined as ...
> 
>  eq
>  ne
>  gt
>  lt
>  ge
>  le
> 
> so one can write code such as 
> 
>    for each Customer where balance gt 1000

The same is also used in Perl and in PPC assembler.
Probably lots of other places, as well. I like them.

--anders
April 04, 2006
Re: not operator operator..
Norbert Nemec wrote:

> Sorry, I don't agree. != has been in C for ages and any C programmer
> should therefore understand !in or !is.
> 
> Unlike in natural language text, source code does ! become more readable
> when using words. It may slightly help the newbie, but it will get in
> the way for everyday use.

Ehrm, wasn't '===' changed to 'is' exactly because it was more readable?
I know many people that prefer 'not' over '!', 'and' over '&&', etc etc.

Originally I didn't see a problem of adding them as alternative syntax, 
but now I know that it would somehow mean the D originals have to go...

So requiring '!is' is bad enough, without making it 'not is' - or worse.
It isn't very beautiful, but then I don't think that was a design goal ?

--anders
« First   ‹ Prev
1 2 3 4 5
Top | Discussion index | About this forum | D home