It is a bug?

2014-07-30 Thread Kozzi11 via Digitalmars-d-learn
#main.d: import m.f; class A { //class main.A member m is not accessible //mixin(t!(typeof(this), m)); void m() {}; //here is ok //mixin(t!(typeof(this), m)); } void main(string[] args){} #m.f module m.f; string t(alias cls, string method)() { import std.traits;

Re: Type deduction on templated constructor.

2014-07-30 Thread Philippe Sigaud via Digitalmars-d-learn
I expected such an answer and I do understand the decisions behind it. Yet, you gave me a really GOOD news! Having to write cast(ubyte) 1 was way too much verbose for my liking, while the new ubyte(1) is reasonable enough. Why not use `1u`?

Re: Type deduction on templated constructor.

2014-07-30 Thread Philippe Sigaud via Digitalmars-d-learn
On Wed, Jul 30, 2014 at 11:46 AM, Philippe Sigaud philippe.sig...@gmail.com wrote: I expected such an answer and I do understand the decisions behind it. Yet, you gave me a really GOOD news! Having to write cast(ubyte) 1 was way too much verbose for my liking, while the new ubyte(1) is

Re: pointer array?

2014-07-30 Thread Leandro Motta Barros via Digitalmars-d-learn
Justin's answers seems correct to me, and I don't know anything about your specific use case, but I cannot resist to add: Think twice before doing this kind of things. I know that sometimes this is necessary or handy, but one of the great things about D is that it provides so many higher-level

Re: pointer array?

2014-07-30 Thread seany via Digitalmars-d-learn
Actually, I am writing a climate simulation software, and I would love to use D for parts of it. However some code is in C, legacy code, and for speed resons. So in some cases, I would like to send a bunch of variables , ints, dubles and floats to an external C function. The thing is, I do

Re: It is a bug?

2014-07-30 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 30 July 2014 at 07:08:17 UTC, Kozzi11 wrote: #main.d: import m.f; class A { //class main.A member m is not accessible //mixin(t!(typeof(this), m)); void m() {}; //here is ok //mixin(t!(typeof(this), m)); } The compiler is trying to construct type A. The first

Re: It is a bug?

2014-07-30 Thread Daniel Kozak via Digitalmars-d-learn
On Wednesday, 30 July 2014 at 16:14:56 UTC, Jesse Phillips wrote: On Wednesday, 30 July 2014 at 07:08:17 UTC, Kozzi11 wrote: #main.d: import m.f; class A { //class main.A member m is not accessible //mixin(t!(typeof(this), m)); void m() {}; //here is ok //mixin(t!(typeof(this),

Re: pointer array?

2014-07-30 Thread Justin Whear via Digitalmars-d-learn
On Wed, 30 Jul 2014 15:44:14 +, seany wrote: However some code is in C, legacy code, and for speed resons. So in some cases, I would like to send a bunch of variables , ints, dubles and floats to an external C function. The thing is, I do not always know the number of variables, so my

Re: pointer array?

2014-07-30 Thread seany via Digitalmars-d-learn
Can you post the signatures of some of the C functions you're trying to interface with? let us take a simple function : int add (int a, int b)

Re: pointer array?

2014-07-30 Thread Leandro Motta Barros via Digitalmars-d-learn
Can't you call it directly? extern(C) { int add (int a, int b)'; } // ... auto ret = add(123, 456); LMB On Wed, Jul 30, 2014 at 2:55 PM, seany via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Can you post the signatures of some of the C functions you're trying to

Re: pointer array?

2014-07-30 Thread Daniel Kozak via Digitalmars-d-learn
V Wed, 30 Jul 2014 14:33:51 + seany via Digitalmars-d-learn digitalmars-d-learn@puremagic.com napsáno: In Ali's excllent book, somehow one thing has escaped my attention, and that it the mentioning of pointer arrays. Can pointers of any type of pointed variable be inserted in an int

Member access of __gshared global object

2014-07-30 Thread Puming via Digitalmars-d-learn
Hi, I'm writing this global Config class, with an AA member: ```d module my.config; class Config { Command[string] commands; } __gshared Config CONFIG; ``` and initialize it in another module: ```d module my.app; import my.config; void main() { CONFIG = new Config();