Jump to page: 1 25  
Page
Thread overview
String comparison ==
Mar 08, 2002
Barry Pederson
Mar 08, 2002
Pavel Minayev
Mar 08, 2002
Walter
Mar 08, 2002
Immanuel Scholz
Mar 08, 2002
Pavel Minayev
Mar 08, 2002
Richard Krehbiel
Mar 08, 2002
Pavel Minayev
Mar 08, 2002
Richard Krehbiel
Mar 08, 2002
Pavel Minayev
Mar 08, 2002
Russ Lewis
Mar 09, 2002
Derjo Phar
Mar 09, 2002
Derjo Phar
Mar 09, 2002
Derjo Phar
Mar 09, 2002
Barry Pederson
Mar 27, 2002
Walter
Mar 27, 2002
Barry Pederson
Mar 27, 2002
Pavel Minayev
Mar 27, 2002
Walter
Mar 27, 2002
Barry Pederson
Mar 14, 2017
Jolly James
Mar 19, 2017
Gand Alf
Mar 22, 2017
Verne Washington
Mar 09, 2002
Pavel Minayev
Mar 09, 2002
Russell Borogove
Mar 09, 2002
Derjo Phar
Mar 09, 2002
Pavel Minayev
And back at operator overloading :) (was: Re: String comparison ==)
Mar 11, 2002
OddesE
Mar 11, 2002
Pavel Minayev
Mar 11, 2002
OddesE
Mar 11, 2002
Russell Borogove
Mar 11, 2002
OddesE
Mar 12, 2002
Russell Borogove
Mar 12, 2002
OddesE
Mar 12, 2002
Pavel Minayev
Mar 12, 2002
Russ Lewis
Mar 12, 2002
Immanuel Scholz
Mar 12, 2002
OddesE
Mar 12, 2002
Russ Lewis
Mar 12, 2002
OddesE
Mar 12, 2002
Russ Lewis
Mar 13, 2002
OddesE
Mar 14, 2002
Barry Pederson
Mar 13, 2002
Roberto Mariottini
Mar 22, 2002
Brock
March 08, 2002
The D HTML page on arrays mentions:

-----------
 Strings can be copied, compared, concatenated, and appended:

   if (str1 < str3) ...
-----------

When I see "compared", I would take that to mean you could compare for content equality using the "==" operator - but that doesn't seem to be the case, and D seems to just do C-style pointer comparisons.

Is string-content comparison using == just something that hasn't been implemented yet?  or are the docs a bit misleading and string.cmp() is how it's going to have to be done?

	Barry

March 08, 2002
"Barry Pederson" <barryp@yahoo.com> wrote in message news:3C883E19.3030407@yahoo.com...

> When I see "compared", I would take that to mean you could compare for
content
> equality using the "==" operator - but that doesn't seem to be the case,
and D
> seems to just do C-style pointer comparisons.

This is the topic raised several times, and I remember we've got
to the idea that some separate operator to compare arrays is needed
(because strings are just char arrays). Walter keeps silent on
the topic, though, so the question is still open.





March 08, 2002
"Barry Pederson" <barryp@yahoo.com> wrote in message news:3C883E19.3030407@yahoo.com...
> The D HTML page on arrays mentions:
>
> -----------
>   Strings can be copied, compared, concatenated, and appended:
>
>     if (str1 < str3) ...
> -----------
>
> When I see "compared", I would take that to mean you could compare for
content
> equality using the "==" operator - but that doesn't seem to be the case,
and D
> seems to just do C-style pointer comparisons.
>
> Is string-content comparison using == just something that hasn't been implemented yet?  or are the docs a bit misleading and string.cmp() is how it's going to have to be done?

The issue is confusing, and it's a bit up in the air at the moment.


March 08, 2002
"Walter" <walter@digitalmars.com> schrieb im Newsbeitrag news:a69s6c$m38$1@digitaldaemon.com...
>
> "Barry Pederson" <barryp@yahoo.com> wrote in message news:3C883E19.3030407@yahoo.com...
> > The D HTML page on arrays mentions:
> >
> > -----------
> >   Strings can be copied, compared, concatenated, and appended:
> >
> >     if (str1 < str3) ...
> > -----------
> >
> > When I see "compared", I would take that to mean you could compare for
> content
> > equality using the "==" operator - but that doesn't seem to be the case,
> and D
> > seems to just do C-style pointer comparisons.
> >
> > Is string-content comparison using == just something that hasn't been implemented yet?  or are the docs a bit misleading and string.cmp() is
how
> > it's going to have to be done?
>
> The issue is confusing, and it's a bit up in the air at the moment.

If I remember right, in Perl the operator "eq" is used.. what about that?

Imi



March 08, 2002
"Walter" <walter@digitalmars.com> wrote in message news:a69s6c$m38$1@digitaldaemon.com...
>
> "Barry Pederson" <barryp@yahoo.com> wrote in message news:3C883E19.3030407@yahoo.com...
> > The D HTML page on arrays mentions:
> >
> > -----------
> >   Strings can be copied, compared, concatenated, and appended:
> >
> >     if (str1 < str3) ...
> > -----------
> >
> > When I see "compared", I would take that to mean you could compare for
> content
> > equality using the "==" operator - but that doesn't seem to be the case,
> and D
> > seems to just do C-style pointer comparisons.
> >
> > Is string-content comparison using == just something that hasn't been implemented yet?  or are the docs a bit misleading and string.cmp() is
how
> > it's going to have to be done?
>
> The issue is confusing, and it's a bit up in the air at the moment.

I might suggest that this is a good reason for having "string" be a separate data type from "char[]".

--
Richard Krehbiel, Arlington, VA, USA
rich@kastle.com (work) or krehbiel3@comcast.net  (personal)



March 08, 2002
"Immanuel Scholz" <digitals-mars@kutzsche.net> wrote in message news:a6antm$10nh$1@digitaldaemon.com...

> If I remember right, in Perl the operator "eq" is used.. what about that?

I always hated it. Too hard to distinguish from name of local variable in a typical D program, anyhow. I believe it should be some sequence of special symbols rather than keyword.

I suggested ~~ and !~ a while ago, but these aren't ideal because they are missing on some national keyboards. Maybe === and !== then? Lengthy, but I personally could leave with it...


March 08, 2002
"Richard Krehbiel" <rich@kastle.com> wrote in message news:a6aos4$118b$1@digitaldaemon.com...

> I might suggest that this is a good reason for having "string" be a
separate
> data type from "char[]".

This has been discussed, and apart from the ability to define operator+ for concatenation, and operators == != < > <= >= for string comparison, it doesn't give any other opportunities.


March 08, 2002
"Pavel Minayev" <evilone@omen.ru> wrote in message news:a6apl9$11fn$1@digitaldaemon.com...
> "Richard Krehbiel" <rich@kastle.com> wrote in message news:a6aos4$118b$1@digitaldaemon.com...
>
> > I might suggest that this is a good reason for having "string" be a
> separate
> > data type from "char[]".
>
> This has been discussed, and apart from the ability to define operator+ for concatenation, and operators == != < > <= >= for string comparison, it doesn't give any other opportunities.

You say that as if those things are inconsequential.  I think they're not. Well, operator + might be.

--
Richard Krehbiel, Arlington, VA, USA
rich@kastle.com (work) or krehbiel3@comcast.net  (personal)



March 08, 2002
"Richard Krehbiel" <rich@kastle.com> wrote in message news:a6av8p$140b$1@digitaldaemon.com...

> You say that as if those things are inconsequential.  I think they're not. Well, operator + might be.

I'm pretty happy with operator~ now. If Walter also gives us array equality/non-equality operator, I'll be completely satisfied.


March 08, 2002
Pavel Minayev wrote:

> "Richard Krehbiel" <rich@kastle.com> wrote in message news:a6aos4$118b$1@digitaldaemon.com...
>
> > I might suggest that this is a good reason for having "string" be a
> separate
> > data type from "char[]".
>
> This has been discussed, and apart from the ability to define operator+ for concatenation, and operators == != < > <= >= for string comparison, it doesn't give any other opportunities.

Indeed, and I think that NOT having a separate type GIVES us new opportunities.  Eventually, we will agree on some sort of syntax that makes sense.  But since char[] is not a unique type with unique rules, this syntax will be able to be used on ALL arrays...perhaps even multidimensional arrays, if we are careful with how we choose the syntax.

--
The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]


« First   ‹ Prev
1 2 3 4 5