English binary logic operators

Hasan Aljudy hasan.aljudy at gmail.com
Wed Nov 8 06:23:12 PST 2006

Bill Baxter wrote:
> BCS wrote:
>> David Qualls wrote:
>>> I just compiled my first D function (adapted from C), and had to
>>> replace all my 'and' 'or' and 'not's with the arcane &&, ||, and !
>>> from prehistoric C to get it to compile.
>>> iso646.h has been a part of C for several years.  Perl, C++ and
>>> possibly other languages have all adopted 'and', 'or', and 'not'
>>> as part of their grammar.
>>> I write software that will be maintained by non-programmers
>>> (mathematicians, who would prefer that I use Fortran).  Lots of
>>> funny symbols in source code (like && || !) make it difficult to
>>> read for the non-immersed (ah, who am I kidding, I even have
>>> trouble reading it now and then).

ummmm .. mathematicians use more complicated symbols and notations than 

>>> Is there any future to D incluing the logical operators in
>>> English, as opposed to &!|%'ish?  (I didn't mention it, but 'mod'
>>> might also be a good (easy for non-programmers to understand)
>>> substitute for '%'.)
>>> David
>> Interesting, I have never heard about iso646.h before. I have never 
>> seen any code that used it either.
> I'd never heard of it either.  But I love the description on this page:
> http://www.frech.ch/man/man0p/iso646.h.0p.html
>       none.
>       none.
> So it's of no use and there's no reason for it.  Great!
>> I only speak for my self, but I wouldn't use it and would find it 
>> harder to use. I like the &!|% version because it doesn't look like an 
>> identifier.
> In &&'s favor it also lets you really cram things together :-)
>      if(a&&b&&c)
> has to become
>      if(a and b and c)
> with words.  But that's not necessarily a good thing.  Which of the 
> above would you rather be staring at at 3am at the end of a long night 
> coding?
> --bb

I actually like symbols in code because they stand out right away.
I always prefer {braces} to begin/end.
At the same time, I hate too many symbols too close to each other.

More information about the Digitalmars-d-learn mailing list