Re: static opCall 'hidden' by incompatible constructors

2014-07-21 Thread Nick Treleaven via Digitalmars-d
On 19/07/2014 10:32, Kagamin wrote: Try to define a constructor with parameters, then compiler won't generate the default constructor, so the parameterless opCall won't be hidden. That only works for classes, not structs.

Re: static opCall 'hidden' by incompatible constructors

2014-07-19 Thread Kagamin via Digitalmars-d
Try to define a constructor with parameters, then compiler won't generate the default constructor, so the parameterless opCall won't be hidden.

Re: static opCall 'hidden' by incompatible constructors

2014-07-18 Thread Nick Treleaven via Digitalmars-d
On 17/07/2014 18:56, Dicebot wrote: It has never worked properly (opCall never got called) and being a bad style going against language design rationale it was completely banned. More info: https://issues.dlang.org/show_bug.cgi?id=12124 Thanks for the link. We need a note in the changelog

Re: static opCall 'hidden' by incompatible constructors

2014-07-18 Thread Nick Treleaven via Digitalmars-d
On 17/07/2014 18:58, Dicebot wrote: (for Unique probably disabling default constructor makes most sense) I'm not sure about that, default construction is useful to be able to delay resource creation: Unique!S u1; ... u1 = unique!S(); // factory function To allow that but

static opCall 'hidden' by incompatible constructors

2014-07-17 Thread Nick Treleaven via Digitalmars-d
Hi, I'm trying to update std.typecons.Unique. I want to add a static opCall with no arguments to simulate a nullary-argument constructor. Unfortunately, with a recent dmd from Git, I get this (reduced code): class Class {} struct U { Class c; this(A...)(A args) if (A.length !=

Re: static opCall 'hidden' by incompatible constructors

2014-07-17 Thread Nick Treleaven via Digitalmars-d
On 17/07/2014 18:11, Nick Treleaven wrote: opcall.d(24): Error: struct opcall.U static opCall is hidden by constructors and can never be called opcall.d(24):Please use a factory method instead, or replace all constructors with static opCall. I should mention that std.typecons.Unique

Re: static opCall 'hidden' by incompatible constructors

2014-07-17 Thread Dicebot via Digitalmars-d
On Thursday, 17 July 2014 at 17:11:29 UTC, Nick Treleaven wrote: I want to add a static opCall with no arguments to simulate a nullary-argument constructor. Please don't do it unless you have a _very_ compelling use case. As nullary static opCall doesn't conflict with a nullary constructor

Re: static opCall 'hidden' by incompatible constructors

2014-07-17 Thread Dicebot via Digitalmars-d
(for Unique probably disabling default constructor makes most sense)