Re: UFCS from within classes

2013-09-10 Thread Jacob Carlborg
On 2013-09-09 19:15, H. S. Teoh wrote: I don't think UFCS works with qualified names right now. This is a known issue. As far as I know it's a design decision. -- /Jacob Carlborg

Re: Adding libraries to an executable

2013-09-10 Thread Jacob Carlborg
On 2013-09-06 23:31, Anton Alexeev wrote: I've written a program which uses curl library. So on a PC without curl the program will not work until you install the library. Is there a way to put the curl library in the executable? On Linux, doesn't all distributions ship with libcurl by default?

Re: What's about virtual?

2013-09-10 Thread Jacob Carlborg
On 2013-09-10 02:28, Andrei Alexandrescu wrote: After I've seen a pretty cool demo of clang-modernize (http://clang.llvm.org/extra/ModernizerUsage.html), I think the best way to attack this and similar problems is to add a class hierarchy analyzer: a command-line utility that is fed an entire

Re: What's about virtual?

2013-09-10 Thread Namespace
On Tuesday, 10 September 2013 at 00:28:24 UTC, Andrei Alexandrescu wrote: On 9/9/13 12:47 PM, H. S. Teoh wrote: On Mon, Sep 09, 2013 at 09:37:07PM +0200, Namespace wrote: It's been a while since Manu convinced Walter and Andrei to introduce a virtual Keyword and to change the default from

Re: Limited type matching?

2013-09-10 Thread Namespace
Currently, all of array types does not allow copy-conversion like ushort to short for their elements. In old D1 age, static array did not have value semantics, so the behavior was expected. In D2, static array had changed to value type, but the behavior was not changed. As far as I know,

named import are always public

2013-09-10 Thread Namespace
I have already found an old bug report for this, but I do not understand why it has still not been solved. Can someone explain that to me? Example: a.d: module a; private import std.stdio : writeln; b.d: import a; void main() { writeln(This is wrong.); } WTF?

Re: named import are always public

2013-09-10 Thread Gary Willoughby
On Tuesday, 10 September 2013 at 08:22:18 UTC, Namespace wrote: I have already found an old bug report for this, but I do not understand why it has still not been solved. Can someone explain that to me? Example: a.d: module a; private import std.stdio : writeln; b.d: import

Re: Adding libraries to an executable

2013-09-10 Thread Anton Alexeev
On Tuesday, 10 September 2013 at 07:02:17 UTC, Jacob Carlborg wrote: On 2013-09-06 23:31, Anton Alexeev wrote: I've written a program which uses curl library. So on a PC without curl the program will not work until you install the library. Is there a way to put the curl library in the

Re: What's about virtual?

2013-09-10 Thread Simen Kjaeraas
On Tue, 10 Sep 2013 02:28:24 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 9/9/13 12:47 PM, H. S. Teoh wrote: On Mon, Sep 09, 2013 at 09:37:07PM +0200, Namespace wrote: It's been a while since Manu convinced Walter and Andrei to introduce a virtual Keyword and to change

Re: What's about virtual?

2013-09-10 Thread Jonathan M Davis
On Tuesday, September 10, 2013 11:27:40 Simen Kjaeraas wrote: On Tue, 10 Sep 2013 02:28:24 +0200, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 9/9/13 12:47 PM, H. S. Teoh wrote: On Mon, Sep 09, 2013 at 09:37:07PM +0200, Namespace wrote: It's been a while since Manu

Re: named import are always public

2013-09-10 Thread Jonathan M Davis
On Tuesday, September 10, 2013 10:22:17 Namespace wrote: I have already found an old bug report for this, but I do not understand why it has still not been solved. Can someone explain that to me? Simple. No one has gotten around to fixing it, just like with any other bug that hasn't been

Re: named import are always public

2013-09-10 Thread Namespace
On Tuesday, 10 September 2013 at 09:35:34 UTC, Jonathan M Davis wrote: On Tuesday, September 10, 2013 10:22:17 Namespace wrote: I have already found an old bug report for this, but I do not understand why it has still not been solved. Can someone explain that to me? Simple. No one has

Re: Linker error with one particular function

2013-09-10 Thread Gary Willoughby
On Friday, 16 August 2013 at 09:52:53 UTC, Gary Willoughby wrote: You might be onto something here as i only import this module into unit tests. When i get time i'll investigate a little further. If i take the import out of the unit test and place it at the top of my source file everything

Re: What's about virtual?

2013-09-10 Thread Namespace
On Tuesday, 10 September 2013 at 09:32:58 UTC, Jonathan M Davis wrote: AFAIK, no official decision has ever been made. It seemed like Walter was convinced that it was worth it to make non-virtual the default, and some discussion went into how to do the transition, but I don't believe that

Re: Limited type matching?

2013-09-10 Thread Kenji Hara
On Tuesday, 10 September 2013 at 08:04:48 UTC, Namespace wrote: Currently, all of array types does not allow copy-conversion like ushort to short for their elements. In old D1 age, static array did not have value semantics, so the behavior was expected. In D2, static array had changed to

Re: Adding libraries to an executable

2013-09-10 Thread Jacob Carlborg
On 2013-09-10 11:04, Anton Alexeev wrote: Can be but not libphobos2 Link statically with it, which is does by default. Just compile with: dmd -L-lcurl test.d -- /Jacob Carlborg

Re: What's about virtual?

2013-09-10 Thread Namespace
Another idea: Currently the protection labels, like public, private etc. , can be restored. But other modifier, like const, nothrow, @safe or, in this case, final can't. I suggest to change this. We could use default for that purpose. Default could interrupt all modifier labels and would

Re: What's about virtual?

2013-09-10 Thread Timon Gehr
On 09/10/2013 02:28 AM, Andrei Alexandrescu wrote: ... After I've seen a pretty cool demo of clang-modernize (http://clang.llvm.org/extra/ModernizerUsage.html), I think the best way to attack this and similar problems is to add a class hierarchy analyzer: a command-line utility that is fed an

Re: What's about virtual?

2013-09-10 Thread Timon Gehr
On 09/10/2013 01:46 PM, Timon Gehr wrote: On 09/10/2013 02:28 AM, Andrei Alexandrescu wrote: ... After I've seen a pretty cool demo of clang-modernize (http://clang.llvm.org/extra/ModernizerUsage.html), I think the best way to attack this and similar problems is to add a class hierarchy

Re: Linker error with one particular function

2013-09-10 Thread Gary Willoughby
On Tuesday, 10 September 2013 at 10:42:44 UTC, Gary Willoughby wrote: On Friday, 16 August 2013 at 09:52:53 UTC, Gary Willoughby wrote: You might be onto something here as i only import this module into unit tests. When i get time i'll investigate a little further. If i take the import out

Re: Limited type matching?

2013-09-10 Thread Namespace
On Tuesday, 10 September 2013 at 10:53:15 UTC, Kenji Hara wrote: On Tuesday, 10 September 2013 at 08:04:48 UTC, Namespace wrote: Currently, all of array types does not allow copy-conversion like ushort to short for their elements. In old D1 age, static array did not have value semantics, so

__FILE__ and __LINE__ again...

2013-09-10 Thread Paolo Invernizzi
Johannes Pfau wrote something like this, in the logger thread: If you write code like this: void log(string file = __FILE__)() //A template { logImpl(file); } void logImpl(string file){} //Not a template The compiler can always inline the log template. So there's no template bloat as there

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread Dicebot
On Tuesday, 10 September 2013 at 16:00:55 UTC, Paolo Invernizzi wrote: Johannes Pfau wrote something like this, in the logger thread: If you write code like this: void log(string file = __FILE__)() //A template { logImpl(file); } void logImpl(string file){} //Not a template The compiler can

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread Dicebot
On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: but you can get rid of this with link-time optimization (on Posix, you'd add -L-gc-sections to your dmd command-line: this will cause ld to delete code sections that are never referenced, which includes the log() instantiations if

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread H. S. Teoh
On Tue, Sep 10, 2013 at 06:50:03PM +0200, Dicebot wrote: On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: but you can get rid of this with link-time optimization (on Posix, you'd add -L-gc-sections to your dmd command-line: this will cause ld to delete code sections that are

Re: What's about virtual?

2013-09-10 Thread Joseph Rushton Wakeling
On 10/09/13 11:32, Jonathan M Davis wrote: AFAIK, no official decision has ever been made. It seemed like Walter was convinced that it was worth it to make non-virtual the default, and some discussion went into how to do the transition, but I don't believe that Andrei has ever liked the idea,

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread H. S. Teoh
On Tue, Sep 10, 2013 at 06:00:53PM +0200, Paolo Invernizzi wrote: Johannes Pfau wrote something like this, in the logger thread: If you write code like this: void log(string file = __FILE__)() //A template { logImpl(file); } void logImpl(string file){} //Not a template The compiler

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread Dicebot
On Tuesday, 10 September 2013 at 16:58:54 UTC, H. S. Teoh wrote: On Tue, Sep 10, 2013 at 06:50:03PM +0200, Dicebot wrote: On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: but you can get rid of this with link-time optimization (on Posix, you'd add -L-gc-sections to your dmd

Re: What's about virtual?

2013-09-10 Thread Jonathan M Davis
On Tuesday, September 10, 2013 18:53:32 Joseph Rushton Wakeling wrote: On 10/09/13 11:32, Jonathan M Davis wrote: AFAIK, no official decision has ever been made. It seemed like Walter was convinced that it was worth it to make non-virtual the default, and some discussion went into how to do

Re: What's about virtual?

2013-09-10 Thread Joseph Rushton Wakeling
On Tuesday, 10 September 2013 at 18:42:16 UTC, Jonathan M Davis wrote: What seemed to have convinced Walter was this interview http://www.artima.com/intv/nonvirtualP.html where the focus was on code maintainability and how C#'s approach to virtuality supported code versioning. However, most

Re: __FILE__ and __LINE__ again...

2013-09-10 Thread Paolo Invernizzi
On Tuesday, 10 September 2013 at 16:45:33 UTC, H. S. Teoh wrote: On Tue, Sep 10, 2013 at 06:00:53PM +0200, Paolo Invernizzi wrote: Johannes Pfau wrote something like this, in the logger thread: If you write code like this: void log(string file = __FILE__)() //A template { logImpl(file); }

How to call a delegate held in a Variant array?

2013-09-10 Thread Gary Willoughby
How to call a delegate held in a Variant array? I'm toying with some dynamic delegate code and wondered if i put a delegate in a Variant how would i call it? class C { private Variant[string] _methods; public void addMethod(T)(string name, T func) {

No 'is not implemented' message with final?

2013-09-10 Thread Namespace
Code: import std.stdio; interface A { public: final void bar(); } class B : A { } void main() { } No message. But: import std.stdio; interface A { public: void bar(); } class B : A { } void main() { } Gives the

Re: No 'is not implemented' message with final?

2013-09-10 Thread Andrej Mitrovic
Bug or feature? You will get a linker error when you try to use the function. This is a feature, because you can implement this function later or even in another module (and set mangling to match). Example of the former: - interface A { public: final void bar(); // declaration

Re: How to call a delegate held in a Variant array?

2013-09-10 Thread H. S. Teoh
On Tue, Sep 10, 2013 at 10:09:33PM +0200, Gary Willoughby wrote: How to call a delegate held in a Variant array? I'm toying with some dynamic delegate code and wondered if i put a delegate in a Variant how would i call it? class C { private Variant[string] _methods; public

Re: No 'is not implemented' message with final?

2013-09-10 Thread Namespace
On Tuesday, 10 September 2013 at 21:03:57 UTC, Andrej Mitrovic wrote: Bug or feature? You will get a linker error when you try to use the function. This is a feature, because you can implement this function later or even in another module (and set mangling to match). Example of the former:

Re: How to call a delegate held in a Variant array?

2013-09-10 Thread Adam D. Ruppe
On Tuesday, 10 September 2013 at 21:16:56 UTC, H. S. Teoh wrote: My first guess would be: _methods[test](); Variant doesn't wrap the function and thus won't know how to call it; it doesn't implement opCall, and even if it did, it won't know types the arguments and return value are. My