Re: operator ~ does not check type?

2011-10-17 Thread Steven Schveighoffer
On Sun, 16 Oct 2011 18:24:26 -0400, Timon Gehr timon.g...@gmx.ch wrote: On 10/13/2011 01:46 PM, Steven Schveighoffer wrote: On Thu, 13 Oct 2011 06:57:09 -0400, Cheng Wei riverch...@gmail.com wrote: == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Wed, 12 Oct 2011

Re: operator ~ does not check type?

2011-10-16 Thread Timon Gehr
On 10/13/2011 01:46 PM, Steven Schveighoffer wrote: On Thu, 13 Oct 2011 06:57:09 -0400, Cheng Wei riverch...@gmail.com wrote: == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Wed, 12 Oct 2011 09:46:57 -0400, Trass3r u...@known.com wrote: I believe that the primary

Re: operator ~ does not check type?

2011-10-13 Thread Steven Schveighoffer
On Thu, 13 Oct 2011 06:57:09 -0400, Cheng Wei riverch...@gmail.com wrote: == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article On Wed, 12 Oct 2011 09:46:57 -0400, Trass3r u...@known.com wrote: I believe that the primary reasoning for allowing the implicit conversion between

operator ~ does not check type?

2011-10-12 Thread Cheng Wei
The following expression compiles but does not make sense. string str = hello ~ 10; assert(str == hello\n); Is this a useful feature or just a bug?

Re: operator ~ does not check type?

2011-10-12 Thread Jonathan M Davis
On Wednesday, October 12, 2011 07:08:05 Cheng Wei wrote: The following expression compiles but does not make sense. string str = hello ~ 10; assert(str == hello\n); Is this a useful feature or just a bug? int and dchar implicitly convert to one another for better or for worse.

Re: operator ~ does not check type?

2011-10-12 Thread bearophile
Cheng Wei: string str = hello ~ 10; assert(str == hello\n); Is this a useful feature or just a bug? I'd call it trash-feature :-| Bye, bearophile

Re: operator ~ does not check type?

2011-10-12 Thread bearophile
Jonathan M Davis: int and dchar implicitly convert to one another for better or for worse. Personally, I'd prefer that they didn't, but that's the way that it is, so I don't believe that this is technically a bug. char-int is OK, but int-char is not so OK. This programs (that compiles with

Re: operator ~ does not check type?

2011-10-12 Thread Jonathan M Davis
On Wednesday, October 12, 2011 03:53:22 bearophile wrote: Jonathan M Davis: int and dchar implicitly convert to one another for better or for worse. Personally, I'd prefer that they didn't, but that's the way that it is, so I don't believe that this is technically a bug. char-int is OK,

Re: operator ~ does not check type?

2011-10-12 Thread deadalnix
Le 12/10/2011 09:53, bearophile a écrit : Jonathan M Davis: int and dchar implicitly convert to one another for better or for worse. Personally, I'd prefer that they didn't, but that's the way that it is, so I don't believe that this is technically a bug. char-int is OK, but int-char is not

Re: operator ~ does not check type?

2011-10-12 Thread Trass3r
I believe that the primary reasoning for allowing the implicit conversion between int and dchar is so that code like this dchar c = 'a' + 7; That's a '+' though, not a '~'. I think it shouldn't be allowed with ~ since it's misleading. Newbies would probably expect abc ~ 10 to yield abc10

Re: operator ~ does not check type?

2011-10-12 Thread Steven Schveighoffer
On Wed, 12 Oct 2011 09:46:57 -0400, Trass3r u...@known.com wrote: I believe that the primary reasoning for allowing the implicit conversion between int and dchar is so that code like this dchar c = 'a' + 7; That's a '+' though, not a '~'. Jonathan meant this better example ;) string s =