View mode: basic / threaded / horizontal-split · Log in · Help
January 21, 2005
Re: What is the difference between 'is' and '==='?
Anders F Björklund wrote:
> Do you actually read your programs out loud ? Haven't done that since
> I went to school

It's not just the students. Teachers have to speak too.
January 21, 2005
Re: What is the difference between 'is' and '==='?
Anders F Björklund wrote:
<snip>
> But "is" and "in" are plenty. Perhaps "is!" and "!in" could work.

"is!" would potentially break existing code.

Stewart.

-- 
My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.
January 21, 2005
Re: What is the difference between 'is' and '==='?
Georg Wrede wrote:

>> Do you actually read your programs out loud ?
>> Haven't done that since I went to school
> 
> It's not just the students. Teachers have to speak too.

Guess I have been at the computer for too long then,
nowadays I mostly communicate through email. Or CVS ;-)

But usually we spoke about design, and then coded the
details. I don't recall long sessions or reading/writing
such signs, or maybe it was just because I skipped those.
Or maybe because they were in a different language anyway ?


Seems I'll still have trouble coding in my native tongue:

> void anders() {}
> void björklund() {}
> 
> void main()
> {
>   anders();
>   björklund();
> }

dmd anders.d 
                               [8]
> /var/tmp//cclIBzkT.s:44:Invalid mnemonic '¶rklundFZv'

So I think I will stick with abstract math symbols, thank you. :)
And using English for communication such as this, and comments.


But if '!==' is now deprecated, then TOKnotidentity should have some
kind of new token shouldn't it ? Then again there is no TOKnotin...
(in dmd/src/dmd/lexer.c and lexer.h, that is; The DMD source code)
Could be since "in" returns a pointer and not a bit, these days ?

But this construct is pretty common: "assert (foo !== null);"

If that is soon deprecated, it needs some kind of replacement ?
I know that Walter will suggest "assert(foo)", so I'll drop it.

--anders

PS. Had the computer read it to me. It *was* funny!
    (App > Services > Speech > Start Speaking Text)
January 21, 2005
Re: What is the difference between 'is' and '==='?
"Walter" <newshound@digitalmars.com> wrote in message news:cspa3k$v95$2@digitaldaemon.com...
>
> "nail" <nail_member@pathlink.com> wrote in message
> news:cson1b$5f6$1@digitaldaemon.com...
>>
>> >PS.
>> >I still think that we need 'isnt' for '!=='
>>
>> In this case isnt must be :)
>>
>> What about future? Does === will become deprecated?
>
> Yes, use "is" from now on. The === turned out to be a problem distinguishing
> from == with some fonts.

So're we getting an 'isnt'?

   if(!(x is null))

is never going to be an attractive form
January 21, 2005
Re: What is the difference between 'is' and '==='?
"Paul Bonser" <misterpib@gmail.com> wrote in message news:cspjj1$1agb$1@digitaldaemon.com...
> Vathix wrote:
>> On Thu, 20 Jan 2005 23:50:43 +0100, Anders F Björklund <afb@algonet.se>  wrote:
>>
>>> Paul Bonser wrote:
>>>
>>>> I must have had a good English teacher in high school, because such  things pain me. (As well as its-it's 
>>>> their-there-they're to-too and a  lot (the only proper way is a lot, two separate words, not one)...but I  guess 
>>>> I'm a bit obsessive compulsive, too...)
>>>
>>>
>>> I guess you're not in favor of an "aint" keyword then ? :-)
>>>
>>> Or maybe it should use "p is not null", just like in SQL...
>>>
>>> Oh, well: !(p is null)
>>>
>>> --anders
>>
>>
>> I like the previously mentioned "p !is null". Would also work with "in",  "key !in aa".
>
> I'm not actually opposed to using isnt, I'd just have a hard time for a while typing it without the "'"...isnot would 
> work, too.

isnot is better
January 21, 2005
Re: What is the difference between 'is' and '==='?
Matthew wrote:

>     if(!(x is null))
> 
> is never going to be an attractive form 

Until there are booleans in D, you can use:

	if(x)

--anders
January 21, 2005
Re: What is the difference between 'is' and '==='?
"Anders F Björklund" <afb@algonet.se> wrote in message news:csqnjr$2hv2$1@digitaldaemon.com...
> Matthew wrote:
>
>>     if(!(x is null))
>>
>> is never going to be an attractive form
>
> Until there are booleans in D, you can use:
>
> if(x)

I'm afraid I never write a non-boolean conditional (sub-)expression, so you won't catch me doing that. ;)
January 21, 2005
Re: What is the difference between 'is' and '==='?
> isnot is better

and "notin"?

L.
January 21, 2005
Re: What is the difference between 'is' and '==='?
Lionello Lunesu wrote:

>>isnot is better
> 
> and "notin"?

Since the "InExpression" is not boolean anymore,
http://www.digitalmars.com/d/expression.html#InExpression
there is no need for any "notin" or "out" version ?


See http://www.digitalmars.com/d/arrays.html#associative :

>  The InExpression yields a pointer to the value if
>  the key is in the associative array, or null if not:
> 
> 	int* p;
> 	p = ("hello" in b);
> 	if (p != null)

And since p is a pointer, it can use == and != checks...
(had p been a reference, that would call opEquals(null))


You can still use the non-boolean shorthand versions:
if ("key" in hashtable) and if (!("key" in hashtable))

But the return type is now a pointer, and not an int.
http://www.digitalmars.com/d/changelog.html#new0107

--anders
January 21, 2005
Re: What is the difference between 'is' and '==='?
Georg Wrede wrote:

> I ignored it, since the main point was kind of obvious.  :-)
> 
> In my mother tongue "at most" is just one word, as is "at least". My 
> gripe is actually the pronunciation of "<=" as "less than or equal to", 
> in all spoken languages. It sounds clumsy and overly technical, 
> especially as it refers to a single operator, or concept, more than a 
> combination of two.
> 
> Back to the original point, I like "isnt". It should be perfectly ok 
> since nobody seems to have a problem with "endif". We might use "isnot", 
> but "isnt" feels nicer.

As an English speaker, "isnt" feels very informal.  I doesn't (!) quite 
feel correct to use informal English contractions in a computer language.
1 2 3 4 5 6 7
Top | Discussion index | About this forum | D home