Next steps of approved DIPs

2019-02-20 Thread Peter Particle via Digitalmars-d-learn
In particular I am interested in DIP 1014 but this question can 
be applied to any approved DIP. Where do I get information about 
e.g. implementer, implementation state/progress, which DMD 
version is expected to include it (apparently not 2.0.85), etc.?


Re: How to get the name of member function through an alias of that function

2018-12-12 Thread Peter Particle via Digitalmars-d-learn
On Wednesday, 12 December 2018 at 08:36:00 UTC, Simen Kjærås 
wrote:
On Wednesday, 12 December 2018 at 08:16:03 UTC, Peter Particle 
wrote:
I prefer that all the members marked with myUDA are process in 
the order thy appear in Foo. This happens automatically when I 
iterate with through 'getMemberByUDA'.


Just replace fullyQualifiedName!member with 
__traits(identifier, member), and things should work.


--
  Simen


How could I have missed that one! THX!


How to get the name of member function through an alias of that function

2018-12-12 Thread Peter Particle via Digitalmars-d-learn
I prefer that all the members marked with myUDA are process in 
the order thy appear in Foo. This happens automatically when I 
iterate with through 'getMemberByUDA'.


// Reduced example code
enum myUDA;
struct Foo {
public:
  @myUDA void  bar(float f) { baz = 1 / f; }
  @myUDA float bar() { return 1 / baz; }
  float baz;
}

import std.traits;
string getMemberFuncName(T)(ref T foo) {
  static foreach(member; getSymbolsByUDA!(T, myUDA)) {
static if(isSomeFunction!member) {

  // Error: function `Test.Foo.bar(float f)` is not callable 
using argument types `()`

  // pragma(msg, member.stringof);

  // Don't want the fully qualified name, just the func name
  pragma(msg, fullyQualifiedName!member);

  // return the name of the first found member function
  //return name;
}
  }
  return "";
}

void main() {
  Foo foo;
  string name = getMemberFuncName(foo);
}


Re: Initialise non-copyable, non-default-constrauctable member struct

2018-07-27 Thread Peter Particle via Digitalmars-d-learn

On Friday, 27 July 2018 at 13:06:10 UTC, aliak wrote:

On Friday, 27 July 2018 at 13:05:07 UTC, aliak wrote:

https://run.dlang.io/is/lLrUiq


Sorry: https://run.dlang.io/is/20FUoj


Thanks, you are right, but it seems that I have reduced my issue 
too much, as it still does not work with my actual case. I will 
try to properly reduce my code to present my issue. I think that 
the simple example can be fully figured out statically, but my 
case not.


Initialise non-copyable, non-default-constrauctable member struct

2018-07-27 Thread Peter Particle via Digitalmars-d-learn

Question is related to this:
https://dlang.org/spec/struct.html#disable_default_construction

struct S {
int x;
@disable this(); // Disables default construction
@disable this(this); // Disable copying

this(int v) { x = v; }
}

struct T {
float y;
S s;
@disable this(); // Disables default construction
@disable this(this); // Disable copying

this(float v) {
y = v;

s = S(cast(int)v);// tried option 1
s.__ctor(cast(int)v); // tried option 2

}
}

Error: struct `S` is not copyable because it is annotated with 
`@disable`

in both cases.

Is there some way around this problem?