Re: Overload of ! operator

2013-06-25 Thread monarch_dodra
On Wednesday, 26 June 2013 at 05:29:49 UTC, Jonathan M Davis wrote: On Wednesday, June 26, 2013 07:15:19 Eric wrote: I should have also added that the overloaded ! method returns a class instance and not a bool. Well, at that point, you're completely out of luck with regards to overloading !.

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 07:15:19 Eric wrote: > I should have also added that the overloaded ! method returns a > class instance and not a bool. Well, at that point, you're completely out of luck with regards to overloading !. In general, D doesn't really support overloading operators in a man

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 07:14:36 cal wrote: > But that code I posted does work, and gives the output shown. Am > I misunderstanding? Then my understanding of how ! is handled is wrong. Apparently !s does get replaced with !cast(bool)s, or it couldn't work. But note that bool b = s; doesn't

Re: Overload of ! operator

2013-06-25 Thread Eric
On Wednesday, 26 June 2013 at 04:59:19 UTC, cal wrote: On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis wrote: Yeah, that should work for the conditions in if, while, and for loops but won't work for anything else (_maybe_ ternary operators, but I'm not sure). So, if you need to be

Re: Overload of ! operator

2013-06-25 Thread cal
On Wednesday, 26 June 2013 at 05:08:07 UTC, Jonathan M Davis wrote: On Wednesday, June 26, 2013 06:59:14 cal wrote: On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis wrote: > Yeah, that should work for the conditions in if, while, and > for > loops but > won't work for anything els

Re: eof

2013-06-25 Thread Ali Çehreli
On 06/25/2013 09:26 PM, lx wrote: > I input ctrl+c,the code will terminate > abnormally.Why this happened? Ctrl-C appears as SIGINT under POSIX systems. You need to register a handler for that signal: import std.stdio; import std.string; import core.sys.posix.signal; bool isDone = false; ex

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 06:59:14 cal wrote: > On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis > > wrote: > > Yeah, that should work for the conditions in if, while, and for > > loops but > > won't work for anything else (_maybe_ ternary operators, but > > I'm not sure). > > So, if

Re: Overload of ! operator

2013-06-25 Thread cal
On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis wrote: Yeah, that should work for the conditions in if, while, and for loops but won't work for anything else (_maybe_ ternary operators, but I'm not sure). So, if you need to be able to do !obj in the general case, that's not going t

Re: Overload of ! operator

2013-06-25 Thread Eric
On Wednesday, 26 June 2013 at 04:16:30 UTC, Ali Çehreli wrote: On 06/25/2013 09:05 PM, Jonathan M Davis wrote: > On Wednesday, June 26, 2013 05:35:03 cal wrote: >> On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote: >>> Is there a way to overload the ! operator? I can't seem to get >>> it t

Re: eof

2013-06-25 Thread Ali Çehreli
On 06/25/2013 09:26 PM, lx wrote: > Ctrl+z seems close the stream.So,if I want > to input another batch of data,it became impossilbe.So,how to reopen the > stream again to allow me to input another batch of data? Making a copy of stdin works on Linux (where the stream is terminated by Ctrl-D in

Re: eof

2013-06-25 Thread lx
On Monday, 24 June 2013 at 21:13:31 UTC, bearophile wrote: I am very confused that ctrl+z didn't teminate the input of console,it result in a dead loop. I think this is a library bug, I noticed it some times, but I didn't file it. Maybe it's worth filing in Bugzilla. I have added this bug re

Re: Overload of ! operator

2013-06-25 Thread Ali Çehreli
On 06/25/2013 09:05 PM, Jonathan M Davis wrote: > On Wednesday, June 26, 2013 05:35:03 cal wrote: >> On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote: >>> Is there a way to overload the ! operator? I can't seem to get >>> it to work with the standard unaryOp method. I need this >>> becaus

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 05:35:03 cal wrote: > On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote: > > Is there a way to overload the ! operator? I can't seem to get > > it to work with the standard unaryOp method. I need this > > because > > I am making a wrapper for a C++ API that has !

Re: Overload of ! operator

2013-06-25 Thread cal
On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote: Is there a way to overload the ! operator? I can't seem to get it to work with the standard unaryOp method. I need this because I am making a wrapper for a C++ API that has ! overloaded. -Eric According to http://dlang.org/operatorov

Re: Overload of ! operator

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 04:50:44 Eric wrote: > Is there a way to overload the ! operator? I can't seem to get > it to work with the standard unaryOp method. I need this because > I am making a wrapper for a C++ API that has ! overloaded. TDPL does not list it as an overloadable operator, so

Re: Overload of ! operator

2013-06-25 Thread bearophile
Eric: Is there a way to overload the ! operator? I can't seem to get it to work with the standard unaryOp method. I need this because I am making a wrapper for a C++ API that has ! overloaded. D is not a superset of C++ and I think there is no way to overload the ! alone. This is by desig

Overload of ! operator

2013-06-25 Thread Eric
Is there a way to overload the ! operator? I can't seem to get it to work with the standard unaryOp method. I need this because I am making a wrapper for a C++ API that has ! overloaded. -Eric

Re: typeof map

2013-06-25 Thread cal
On Tuesday, 25 June 2013 at 06:58:33 UTC, monarch_dodra wrote: On Tuesday, 25 June 2013 at 04:26:00 UTC, Timothee Cour wrote: I think it's because each lambda litteral is treated unique. can dmd be changed to recognize identical lambda litterals as identical? Is there any particular issue maki

Re: mutable constant?

2013-06-25 Thread Ali Çehreli
With apologies, I have unrelated comments to make. On 06/25/2013 03:07 PM, Namespace wrote: > this(T x, T y) { > this.x = x; > this.y = y; > > points ~= &this._point; I have seen similar designs in the past where constructors had side-effects such as registering

Re: mutable constant?

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 00:52:58 Namespace wrote: > If you change uint to size_t it works fine AFAIK. Yes. It's easy enough to fix, but it _is_ arguably a bug in the code, and it's the only one that's obvious to me. I don't understand what about the code makes you think that it might be viol

Re: mutable constant?

2013-06-25 Thread Namespace
If you change uint to size_t it works fine AFAIK.

Re: mutable constant?

2013-06-25 Thread Jonathan M Davis
On Wednesday, June 26, 2013 00:07:38 Namespace wrote: > I want to ask if this code should compile or if it's a bug, > because I circumvent the const system: > > > import std.stdio; > > struct Point { > int x, y; > } > > Point*[] points; > > struct TplPoint(T) { > public: > Point _point; >

Re: mutable constant?

2013-06-25 Thread Simen Kjaeraas
On Wed, 26 Jun 2013 00:07:38 +0200, Namespace wrote: I want to ask if this code should compile or if it's a bug, because I circumvent the const system: import std.stdio; struct Point { int x, y; } Point*[] points; struct TplPoint(T) { public: Point _point;

mutable constant?

2013-06-25 Thread Namespace
I want to ask if this code should compile or if it's a bug, because I circumvent the const system: import std.stdio; struct Point { int x, y; } Point*[] points; struct TplPoint(T) { public: Point _point; T x, y; const uint id; this(T x, T y) {

Re: Trouble with lockstep

2013-06-25 Thread Joseph Rushton Wakeling
On Tuesday, 25 June 2013 at 10:52:22 UTC, Andrej Mitrovic wrote: On 6/25/13, Andrej Mitrovic wrote: It's now fixed in git-head. Chances are we're not going to have another 2.063 point release (I'm only speculating) so you may have to use the latest git-head version to use lockstep. That's a

Re: Problems building docs

2013-06-25 Thread Jesse Phillips
On Monday, 24 June 2013 at 19:20:44 UTC, H. S. Teoh wrote: For me personally, I find that nesting dmd/druntime/phobos inside the git checkout of d-programming-language.org a tad ugly, so I use this instead: parent/d-programming-language.org parent/d-programming-language.org/web

Re: Trouble with lockstep

2013-06-25 Thread Andrej Mitrovic
On 6/25/13, Andrej Mitrovic wrote: > It's a regression which I've caused. I've made a fixup pull: > > http://d.puremagic.com/issues/show_bug.cgi?id=10468 > > I'm very sorry for this mishap. It's now fixed in git-head. Chances are we're not going to have another 2.063 point release (I'm only specu

Re: Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

2013-06-25 Thread David
Am 24.06.2013 22:50, schrieb bearophile: > David: > >> What kind of bugs does it avoid? >> I can't think of a single bug which could happen... >> (Ranges/Lengths are checked at runtime...) > > Some reasons: > - Syntax uniformity: similar behaviours should look similar. This is a > general rule of

Re: typeof map

2013-06-25 Thread monarch_dodra
On Tuesday, 25 June 2013 at 04:26:00 UTC, Timothee Cour wrote: I think it's because each lambda litteral is treated unique. can dmd be changed to recognize identical lambda litterals as identical? Is there any particular issue making that difficult? it already recognizes identical string litera