Re: Possible bug

2013-03-26 Thread Sergei Nosov
On Tuesday, 26 March 2013 at 05:40:00 UTC, Steven Schveighoffer wrote: What you have to do is instantiate the template, then call the constructor: S!(int, 4).S!(byte, 5)(3) Note that the way templates work in D, a templated struct is really a shortcut for: template S(T) { struct S { ...

Re: Thrift D bindings: make check broken under ubuntu 12.04. Where to report?

2013-03-26 Thread Johannes Pfau
Am Mon, 25 Mar 2013 19:43:11 +0100 schrieb "J" : > Where or to whom should I report a bug in the thrift D bindings? > > In recent ubuntu, the maintainers inexplicably changed the linker > (ld) defaults to --as-needed, which breaks the 'make check' for > Thrifts D binding, presumably because the

Re: When to call setAssertHandler?

2013-03-26 Thread Jacob Carlborg
On 2013-03-22 10:58, Benjamin Thaut wrote: So I want to install my own assertHandler. The problem is, that even if I call "setAssetHandler" in a shared module constructor, and that module does not import any other modules, it is still not initialized first. Is there a way to set the assert before

Re: Named Tuple Names

2013-03-26 Thread Jacob Carlborg
On 2013-03-25 23:58, Jonathan Crapuchettes wrote: Is there a way to get the names of the fields in a named tuple? It looks like the names are actually aliases. Perhaps "fieldSpecs". -- /Jacob Carlborg

Re: Question about auto ref

2013-03-26 Thread Namespace
I wonder, if someone has already thought about "immutable ref". I can not imagine that many use it, so it wouldn't break (much) code.

Re: isExpression with bool template parameter

2013-03-26 Thread Ali Çehreli
On 03/25/2013 11:15 PM, cal wrote: > On Tuesday, 26 March 2013 at 06:03:55 UTC, cal wrote: >> I.e., why I can't match on some generic second parameter - what if the >> second parameter was an int: >> >> struct S(A, int B) {} >> static assert(is(S!(int, 5627) _ == S!(U, ??), U, ??)); >> >> how to m

Re: isExpression with bool template parameter

2013-03-26 Thread cal
On Tuesday, 26 March 2013 at 13:45:52 UTC, Ali Çehreli wrote: There are three kinds of template parameters: type, value, and alias. That syntax does not work because you are trying to match 5 to V, where 5 is a value and V is a type. Ali Thanks Ali, I guess the tuple version is fine, it i

Orange lib help

2013-03-26 Thread Dan
Hi - I get some errors from this simple code: class Class_a { double[2][2] ob; } class Class_b : Class_a { int obb;} Serializer.register!(Class_b); The error is: Error: variable orange.serialization.Serializer.Serializer.serializeArray!(inout(double[2LU][2LU])).serializeArray.__lambda2008._

Re: Question about auto ref

2013-03-26 Thread Namespace
On Tuesday, 26 March 2013 at 11:41:13 UTC, Namespace wrote: I wonder, if someone has already thought about "immutable ref". I can not imagine that many use it, so it wouldn't break (much) code. immutable ref works (for me) very well. Are there any pitfalls that I can not see?

Re: Named Tuple Names

2013-03-26 Thread Jonathan Crapuchettes
On Tue, 26 Mar 2013 10:13:03 +0100, Jacob Carlborg wrote: > On 2013-03-25 23:58, Jonathan Crapuchettes wrote: >> Is there a way to get the names of the fields in a named tuple? It >> looks like the names are actually aliases. > > Perhaps "fieldSpecs". Well, that gets you a FieldSpec template whi

Re: Question about auto ref

2013-03-26 Thread Jonathan M Davis
On Tuesday, March 26, 2013 17:22:29 Namespace wrote: > On Tuesday, 26 March 2013 at 11:41:13 UTC, Namespace wrote: > > I wonder, if someone has already thought about "immutable ref". > > I can not imagine that many use it, so it wouldn't break (much) > > code. > > immutable ref works (for me) very

Re: Question about auto ref

2013-03-26 Thread Timothee Cour
how about '&' : void fun(int & x); which is same as C++ syntax, hence familiar. I thought someone had proposed that a few weeks ago On Tue, Mar 26, 2013 at 9:56 AM, Jonathan M Davis wrote: > On Tuesday, March 26, 2013 17:22:29 Namespace wrote: >> On Tuesday, 26 March 2013 at 11:41:13 UTC, Names

Re: Named Tuple Names

2013-03-26 Thread cal
On Tuesday, 26 March 2013 at 16:31:51 UTC, Jonathan Crapuchettes wrote: but I wish there was a cleaner way to do it. If the FieldSpec template was moved into the public section, it would allow for the name member to be accessed. Not sure this qualifies as clean, but it's an option: import s

Re: Question about auto ref

2013-03-26 Thread Jonathan M Davis
On Tuesday, March 26, 2013 10:02:32 Timothee Cour wrote: > how about '&' : > > void fun(int & x); > > which is same as C++ syntax, hence familiar. I thought someone had > proposed that a few weeks ago That would be a much larger change, and I'd be surprised if Walter or Andrei went for that. Pi

Re: When to call setAssertHandler?

2013-03-26 Thread Benjamin Thaut
Am 26.03.2013 10:09, schrieb Jacob Carlborg: On 2013-03-22 10:58, Benjamin Thaut wrote: So I want to install my own assertHandler. The problem is, that even if I call "setAssetHandler" in a shared module constructor, and that module does not import any other modules, it is still not initialized

Re: When to call setAssertHandler?

2013-03-26 Thread Benjamin Thaut
Am 25.03.2013 23:49, schrieb Sean Kelly: On Mar 22, 2013, at 2:58 AM, Benjamin Thaut wrote: So I want to install my own assertHandler. The problem is, that even if I call "setAssetHandler" in a shared module constructor, and that module does not import any other modules, it is still not init

Re: Orange lib help

2013-03-26 Thread Jacob Carlborg
On 2013-03-26 16:34, Dan wrote: Hi - I get some errors from this simple code: class Class_a { double[2][2] ob; } class Class_b : Class_a { int obb;} Serializer.register!(Class_b); The error is: Error: variable orange.serialization.Serializer.Serializer.serializeArray!(inout(double[2LU][2LU

Re: When to call setAssertHandler?

2013-03-26 Thread Jacob Carlborg
On 2013-03-26 19:35, Benjamin Thaut wrote: Yes, but this workaround does not work for windows 64 bit as the microsoft linker complains about duplicate symbols. Also I think it will only work with dmd because all other compiles (I tested with gdc) also complain about duplicate symbols. I suspec

how to get paths to files compiled by rdmd in resulting binary

2013-03-26 Thread Timothee Cour
I wrote a stacktrace tool that shows a nice stacktrace upon error, with file names, demangled D symbols and (sometimes) line numbers. It works on OSX and linux and uses execlp behind the hoods. Problem: for some silly reason I can only get stack trace info of the form: D5main28main_auxFZi (in mai

how to parse mangled/demangled name into function name, arguments etc.

2013-03-26 Thread Timothee Cour
demangle D15bootstrap_utils4util15replace_macros2FKHAyaAyaAyaZAya immutable(char)[] bootstrap_utils.util.replace_macros2(ref immutable(char)[][immutable(char)[]], immutable(char)[]) I want to obtain function name, arguments, etc (eg AST as json output would show) is there a reliable library solu

Re: Question about auto ref

2013-03-26 Thread Minas Mina
Why is "const ref" not a good choice?

Re: Question about auto ref

2013-03-26 Thread Jonathan M Davis
On Tuesday, March 26, 2013 22:55:56 Minas Mina wrote: > Why is "const ref" not a good choice? I really don't want to get into that again. There have been a number of discussions on it in the main newsgroup which you can search for, but Andrei considers it to be a major mistake of C++ that const&

Re: Question about auto ref

2013-03-26 Thread Jonathan M Davis
On Tuesday, March 26, 2013 18:11:42 Jonathan M Davis wrote: > On Tuesday, March 26, 2013 22:55:56 Minas Mina wrote: > > Why is "const ref" not a good choice? > > I really don't want to get into that again. There have been a number of > discussions on it in the main newsgroup which you can search f

Re: A little of coordination for Rosettacode

2013-03-26 Thread bearophile
This task has just a Tango entry: http://rosettacode.org/wiki/Concurrent_computing So I am writing a Phobos version. This seems to work as requested: import std.stdio, std.random, std.parallelism, core.thread, core.time; void main() { foreach (m; ["Enjoy", "Rosetta", "Code"]) ta

No subclass member loopup in derived class, bug?

2013-03-26 Thread Henning Pohl
struct S { int value() { return 1; } } class Base { S s; alias s this; } class Derived : Base { void func() { int i = value(); } } Fails with "main.d(14): Error: undefined identifier value". Explicitly casting this to Base works: void func() {

Re: No subclass member loopup in derived class, bug?

2013-03-26 Thread Ali Çehreli
On 03/26/2013 04:58 PM, Henning Pohl wrote: > struct S { > int value() { > return 1; > } > } > > class Base { > S s; > alias s this; > } > > class Derived : Base { > void func() { > int i = value(); > } > } > > Fails with "main.d(14): Error: undefined identifier value". > Explicitly casting this t

Re: Question about auto ref

2013-03-26 Thread Namespace
"Thats the reason why all following declarations behave as const:" should be "Thats the reason why all following declarations behave as const&:"

Re: Question about auto ref

2013-03-26 Thread Namespace
I tried the last few hours to implement something like 'A&' but it's horrible if you haven't complete knowledge and want to implement something that comes after the type... But what's wrong with '@ref'? If I had knowledge how you could implement new properties I could start a trial. Afte

Re: No subclass member loopup in derived class, bug?

2013-03-26 Thread bearophile
Henning Pohl: class Base { S s; alias s this; } "alias this" is meant to be used in structs. Bye, bearophile

Re: No subclass member loopup in derived class, bug?

2013-03-26 Thread bearophile
"alias this" is meant to be used in structs. On the other hand, unless the compiler refuses to compile a class with an alias this, it should behave meaningfully. Bye, bearophile

Re: No subclass member loopup in derived class, bug?

2013-03-26 Thread Jonathan M Davis
On Tuesday, March 26, 2013 17:24:20 Ali Çehreli wrote: > On 03/26/2013 04:58 PM, Henning Pohl wrote: > > struct S { > > int value() { > > return 1; > > } > > } > > > > class Base { > > S s; > > alias s this; > > } > > > > class Derived : Base { > > void func() { > > int i = value(); > > } > > } >