COM Example work for anyone?

2012-10-13 Thread Jesse Phillips
The dmd compiler comes with some example code. One of the examples is for COM. Does this work for anyone else? The dll registration code is failing: SetKeyAndValue() failed. Other output looks good: OLE 2 initialized hMod = 268435456 LoadLibraryA() succeeded pfn = 100033E0, fn = 'DllRegister

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Maxim Fomin
On Saturday, 13 October 2012 at 17:01:27 UTC, Tommi wrote: Another way to describe my reasoning... According to TDPL, if var is a variable of a user-defined type, then: ++var gets rewritten as: var.opUnary!"++"() Not always. If user-defined type has an alias this to integer member, than som

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Maxim Fomin
On Saturday, 13 October 2012 at 22:34:19 UTC, H. S. Teoh wrote: OK, before this thread devolves into a shouting match, I'd like to understand what was the rationale behind this restriction. What were the reasons behind not allowing a non-member function to overload an operator? What are the pro

Re: std.stream, BOM, and deprecation

2012-10-13 Thread Ali Çehreli
On 10/13/2012 06:53 PM, Charles Hixson wrote: > If std.stream is being deprecated, what is the correct way to deal with > file BOMs. This is particularly concerning utf8 files, which I > understand to be a bit problematic, as there isn't, actually, a utf8 > BOM, That's correct. There is just one

Re: std.stream, BOM, and deprecation

2012-10-13 Thread Jonathan M Davis
On Saturday, October 13, 2012 18:53:48 Charles Hixson wrote: > If std.stream is being deprecated, what is the correct way to deal with > file BOMs. This is particularly concerning utf8 files, which I > understand to be a bit problematic, as there isn't, actually, a utf8 > BOM, merely a convention

std.stream, BOM, and deprecation

2012-10-13 Thread Charles Hixson
If std.stream is being deprecated, what is the correct way to deal with file BOMs. This is particularly concerning utf8 files, which I understand to be a bit problematic, as there isn't, actually, a utf8 BOM, merely a convention which isn't a part of a standard. But the std.stdio documentatio

Re: opIs broke for structs?

2012-10-13 Thread Era Scarecrow
On Saturday, 13 October 2012 at 22:19:44 UTC, H. S. Teoh wrote: Wait, there's such a thing as overloading 'is'? If there is, that's pretty messed up. The 'is' operator is used for a lot of fundamental stuff, and allowing structs and classes to change that just sounds ... wrong. Sure there is

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Timon Gehr
On 10/14/2012 12:36 AM, H. S. Teoh wrote: On Sun, Oct 14, 2012 at 12:12:01AM +0200, Timon Gehr wrote: On 10/13/2012 10:15 PM, Jonathan M Davis wrote: [...] but they _aren't_ mixed and they will _never_ be mixed. If it had _ever_ been intended that it be possible to overload operators as free f

Re: opIs broke for structs?

2012-10-13 Thread bearophile
Era Scarecrow: I'm curious why this would break and not work, as is should compare against it's location/entity correct? I wonder why it breaks then for structs on the stack. I can only find 'opIs missing' when searching for it, so... "is" is meant to perform a bitwise comparison (I think t

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread H. S. Teoh
On Sun, Oct 14, 2012 at 12:12:01AM +0200, Timon Gehr wrote: > On 10/13/2012 10:15 PM, Jonathan M Davis wrote: [...] > >but they _aren't_ mixed and they will _never_ be mixed. If it had > >_ever_ been intended that it be possible to overload operators as > >free functions, then we'd simply have made

Re: opIs broke for structs?

2012-10-13 Thread H. S. Teoh
On Sat, Oct 13, 2012 at 11:40:04PM +0200, Era Scarecrow wrote: > I'm curious why this would break and not work, as is should compare > against it's location/entity correct? I wonder why it breaks then > for structs on the stack. I can only find 'opIs missing' when > searching for it, so... [...]

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Timon Gehr
On 10/13/2012 10:15 PM, Jonathan M Davis wrote: ... construct is using syntactic sugar such as UFCS, because _all_ of that syntactic sugar must be lowered to code which _isn't_ syntactic sugar anymore. That is not what lowering means. It would be far more expensive to have to continually make

Re: Good D book

2012-10-13 Thread Jeremy DeHaan
Thanks, guys! I will definitely pick up TDPL! And I have seen the online book by Ali Çehreli, and actually have a copy saved. It is a great source. Thanks again for all the input!

opIs broke for structs?

2012-10-13 Thread Era Scarecrow
I'm curious why this would break and not work, as is should compare against it's location/entity correct? I wonder why it breaks then for structs on the stack. I can only find 'opIs missing' when searching for it, so... struct X { int x; } class Y { int y; } Y y1 = new Y(); Y y2 = n

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Jonathan M Davis
On Saturday, October 13, 2012 19:01:26 Tommi wrote: > Another way to describe my reasoning... > > According to TDPL, if var is a variable of a user-defined type, > then: > ++var > gets rewritten as: > var.opUnary!"++"() > > Thus, it would be very logical to assume that it doesn't matter > whether

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Timon Gehr
On 10/13/2012 06:02 PM, Maxim Fomin wrote: ... Different groups of people have different mind and same things produce different sense on them. From my point of view operator overloading methods are special functions and not treating them as candidates for UFCS does make more sense. I do not und

Re: Good D book

2012-10-13 Thread Ali Çehreli
On 10/13/2012 05:42 AM, Lubos Pintes wrote: > So this means there is no chance to obtain the TDPL legally in some > accessible format? My copy of the TDPL says "free online edition with the purchase of this book." It's supposed to be an Safari Online Books. > For blind, PDF or even paper makes

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Tommi
Another way to describe my reasoning... According to TDPL, if var is a variable of a user-defined type, then: ++var gets rewritten as: var.opUnary!"++"() Thus, it would be very logical to assume that it doesn't matter whether you write: ++var ...or, write the following instead: var.opUnary!"

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Tommi
On Saturday, 13 October 2012 at 16:02:25 UTC, Maxim Fomin wrote: From my point of view operator overloading methods are special functions and not treating them as candidates for UFCS does make more sense. I can think of only one thing that makes custom operator methods "special" or different f

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Maxim Fomin
On Saturday, 13 October 2012 at 15:06:14 UTC, Tommi wrote: On Saturday, 13 October 2012 at 11:50:40 UTC, Maxim Fomin wrote: I think implementing UFCS operator overloading is problematic. Firstly, you want to put this language addition too far. I don't see this as taking UFCS functionality "fur

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Tommi
On Saturday, 13 October 2012 at 11:50:40 UTC, Maxim Fomin wrote: I think implementing UFCS operator overloading is problematic. Firstly, you want to put this language addition too far. I don't see this as taking UFCS functionality "further". Rather, I think it's simply more logical that with U

Re: Good D book

2012-10-13 Thread H. S. Teoh
On Sat, Oct 13, 2012 at 11:29:29AM +0200, Jeremy DeHaan wrote: > I've been using D for a few months now, and i love it. It dawned on > me that it would be nice to have some books to go over though! > > I saw "The D Programming Language" by Andrei Alexandrescu on Amazon, > and I almost bought it wh

Re: Automated D code editing?

2012-10-13 Thread Aziz K.
On Fri, 12 Oct 2012 21:43:07 +0200, Andrej Mitrovic wrote: You mean at compile-time? Try this: http://dpaste.dzfl.pl/06b95c3f Copied below: [SNIP] That's pretty ingenious!

Re: Automated D code editing?

2012-10-13 Thread Andrej Mitrovic
On 10/13/12, Lubos Pintes wrote: > Although I thought about refactoring, which I know is not available yet, > this was very interesting example (for me as newbye). Ah ok. Well it wouldn't be too difficult to write a small D script that does this on source files. You wouldn't need a full-fledged p

Re: Why doesn't DMD recreate folder structure when using multiple .d files and -H?

2012-10-13 Thread Andrej Mitrovic
On 10/13/12, Jordi Sayol wrote: > $ dmd -op -H -o- atk/Action.d gio/DBusProxy.d -Hdinclude Damn, I never knew what -op did (it should mention it's useful for -H). Thanks.

Re: Is there a thread safe single linked list?

2012-10-13 Thread denizzzka
Not that the "titanic" but the authors, probably, have used Java and another type of cas result returns.

Re: Good D book

2012-10-13 Thread Lubos Pintes
So this means there is no chance to obtain the TDPL legally in some accessible format? I mean similar to chapter 1, which is released on dlang.org. For blind, PDF or even paper makes no sense... Well, PDF sometimes, but rarely. Dňa 13. 10. 2012 11:40 Jonathan M Davis wrote / napísal(a): On Sa

Re: Good D book

2012-10-13 Thread Jordi Sayol
Al 13/10/12 11:29, En/na Jeremy DeHaan ha escrit: > I've been using D for a few months now, and i love it. It dawned on me that > it would be nice to have some books to go over though! > > I saw "The D Programming Language" by Andrei Alexandrescu on Amazon, and I > almost bought it when I saw it

Re: Is there a thread safe single linked list?

2012-10-13 Thread denizzzka
On Friday, 12 October 2012 at 23:30:39 UTC, Sean Kelly wrote: I would be grateful if someone share singly linked list based on cas() There's a sample Stack and SList implementation in the concurrency chapter: http://www.informit.com/articles/printerfriendly.aspx?p=1609144 Of course, I r

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Maxim Fomin
On Saturday, 13 October 2012 at 10:00:22 UTC, Tommi wrote: On Saturday, 13 October 2012 at 09:50:05 UTC, Jonathan M Davis wrote: It is most definitely _by design_ that you cannot overload operators except as member functions. I don't understand this design choice then. I don't see any problem

Re: Save JSONValue binary in file?

2012-10-13 Thread Jacob Carlborg
On 2012-10-13 01:26, Sean Kelly wrote: Here are my results: $ dmd -release -inline -O dtest $ ll input.txt -rw-r--r-- 1 sean staff 365105313 Oct 12 15:50 input.txt $ time dtest real 1m36.462s user 1m32.468s sys 0m1.102s Then I ran my SAX style parser example on the same input file:

Re: revamped candydoc

2012-10-13 Thread Jacob Carlborg
On 2012-10-12 21:06, Aziz K. wrote: What? You don't like my soft, green colours? Shame on you! :P Hehe :) Ok, I'm not happy with the style myself, but I want to concentrate on functionality more atm. Understandable. I'm not very good with design and graphics myself so I probably shouldn't

Re: revamped candydoc

2012-10-13 Thread Jacob Carlborg
On 2012-10-12 16:55, Aziz K. wrote: That was a good read, but unfortunately it deterred me from using submodules. Sounds like too much trouble for me. It's not worth the hassle if it requires that much care and attention. Only git can get away with such atrocious usability issues. lol Ok, I ac

Re: revamped candydoc

2012-10-13 Thread Jacob Carlborg
On 2012-10-12 17:05, Aziz K. wrote: Yeah, no disagreement there. It's working fine thanks to the awesome work SiegeLord put into porting it to D2. I'll definitely stay with Tango, but external dependencies can be quite annoying, so maybe I'll just copy the modules I need and leave the rest. Ok

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Tommi
On Saturday, 13 October 2012 at 09:50:05 UTC, Jonathan M Davis wrote: It is most definitely _by design_ that you cannot overload operators except as member functions. I don't understand this design choice then. I don't see any problem in allowing UFCS operators. Because of the way UFCS works,

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Jonathan M Davis
On Saturday, October 13, 2012 11:41:07 Tommi wrote: > On Saturday, 13 October 2012 at 09:06:28 UTC, Jakob Ovrum wrote: > > Do note that this says *method* call. Your example doesn't use > > methods. Hence, the current state of operator overloading is > > consistent with TDPL. > > I don't agree wit

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Tommi
On Saturday, 13 October 2012 at 09:06:28 UTC, Jakob Ovrum wrote: Do note that this says *method* call. Your example doesn't use methods. Hence, the current state of operator overloading is consistent with TDPL. I don't agree with the last sentence. According to TDPL: 1) "whenever at least one

Re: Good D book

2012-10-13 Thread Nick Sabalausky
On Sat, 13 Oct 2012 11:29:29 +0200 "Jeremy DeHaan" wrote: > I've been using D for a few months now, and i love it. It dawned > on me that it would be nice to have some books to go over though! > > I saw "The D Programming Language" by Andrei Alexandrescu on > Amazon, and I almost bought it whe

Re: Good D book

2012-10-13 Thread Jonathan M Davis
On Saturday, October 13, 2012 11:29:29 Jeremy DeHaan wrote: > I've been using D for a few months now, and i love it. It dawned > on me that it would be nice to have some books to go over though! > > I saw "The D Programming Language" by Andrei Alexandrescu on > Amazon, and I almost bought it when

Good D book

2012-10-13 Thread Jeremy DeHaan
I've been using D for a few months now, and i love it. It dawned on me that it would be nice to have some books to go over though! I saw "The D Programming Language" by Andrei Alexandrescu on Amazon, and I almost bought it when I saw it was written in 2010. I know that D is under development,

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Jonathan M Davis
On Saturday, October 13, 2012 11:06:27 Jakob Ovrum wrote: > On Saturday, 13 October 2012 at 08:36:19 UTC, Tommi wrote: > > Quote from TDPL: "D’s approach to operator overloading is > > simple: whenever at least one participant in an operator > > expression is of user-defined type, the compiler rewr

Re: Operator overloading through UFCS doesn't work

2012-10-13 Thread Jakob Ovrum
On Saturday, 13 October 2012 at 08:36:19 UTC, Tommi wrote: Quote from TDPL: "D’s approach to operator overloading is simple: whenever at least one participant in an operator expression is of user-defined type, the compiler rewrites the expression into a regular method call with a specific name.

Operator overloading through UFCS doesn't work

2012-10-13 Thread Tommi
Quote from TDPL: "D’s approach to operator overloading is simple: whenever at least one participant in an operator expression is of user-defined type, the compiler rewrites the expression into a regular method call with a specific name. Then the regular language rules apply." According to the

Re: Automated D code editing?

2012-10-13 Thread Lubos Pintes
Blindly replacing identifiers is certainly not what I need, I want for example FormStartPosition.CENTER_SCREEN to be written like FormStartPosition.centerScreen; Enums in DGUI are written like enum FormStartPosition { CENTER_SCREEN = SOME_WINDOWS_API_VALUE, ... } I need SOME_WINDOWS_API_VALU

Re: Automated D code editing?

2012-10-13 Thread Lubos Pintes
Although I thought about refactoring, which I know is not available yet, this was very interesting example (for me as newbye). Dňa 12. 10. 2012 21:43 Andrej Mitrovic wrote / napísal(a): On 10/12/12, Lubos Pintes wrote: Hi, I am still playing with DGUI library. Besides other things, I would li