visibility deprecation with last dmd compiler

2017-05-03 Thread jacob via Digitalmars-d-learn
I have 2 files file abc.d: == module my.abc; class Abc { private int x; this() { this.x = 1; } } == and xyz.d: == module my.xyz; import my.abc; class Xyz: Abc { this() { super(); this.x = 2; } } == Compilation fails with "Deprecation: my.abc.Abc.x is not visible from module xyz"

Re: Pointer to private structure

2016-12-19 Thread Nikhil Jacob via Digitalmars-d-learn
On Monday, 19 December 2016 at 10:14:49 UTC, Ali wrote: On Monday, 19 December 2016 at 06:42:27 UTC, Nikhil Jacob wrote: [...] What're you trying to do here? Forward declarations in C++ are used to solve a few different things: 1. Reduce build times (unneeded in D AFAIK) 2. Break cyclic

Re: Pointer to private structure

2016-12-18 Thread Nikhil Jacob via Digitalmars-d-learn
On Monday, 19 December 2016 at 06:21:10 UTC, ketmar wrote: i bet that just trying this with D compiler will take less time than writing forum post. I did try but it seems to give compilation failure... Let me try once more and I will get back with more details.

Pointer to private structure

2016-12-18 Thread Nikhil Jacob via Digitalmars-d-learn
In C, we can define a struct without body in an include file and use pointer to that structure For examples in public header file. struct data; data* new_data(); We can then define the elements of struct data privately inside the implementation of library. Can we do this in D without

Re: How to override impure function from pure function

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
On Tuesday, 13 December 2016 at 05:10:02 UTC, Nicholas Wilson wrote: On Tuesday, 13 December 2016 at 04:48:11 UTC, Nikhil Jacob wrote: In the D spec for pure functions it says that a pure function can override "can override an impure function, but an impure function cannot override a pure

How to override impure function from pure function

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
In the D spec for pure functions it says that a pure function can override "can override an impure function, but an impure function cannot override a pure one" Can anyone help me how to do this ?

Re: Check whether function/delegate uses any shared or global variables

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
On Monday, 12 December 2016 at 12:30:42 UTC, Jacob Carlborg wrote: On 2016-12-12 12:15, Nicholas Wilson wrote: there is the pure function attribute, how ever this still allows you to use globals *if you pass them as parameters to the function*. And it can access immutable global data.

Re: Check whether function/delegate uses any shared or global variables

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
On Monday, 12 December 2016 at 11:15:28 UTC, Nicholas Wilson wrote: On Monday, 12 December 2016 at 11:02:21 UTC, Nikhil Jacob wrote: Is there any way to check whether a function/delegate passed to a function uses any shared or global variables ? I could not find any in std.traits. there is

Check whether function/delegate uses any shared or global variables

2016-12-12 Thread Nikhil Jacob via Digitalmars-d-learn
Is there any way to check whether a function/delegate passed to a function uses any shared or global variables ? I could not find any in std.traits.

Re: sending shared pointer to struct. message type mismatch

2016-04-21 Thread jacob via Digitalmars-d-learn
On Thursday, 21 April 2016 at 17:33:32 UTC, ag0aep6g wrote: On 21.04.2016 19:10, jacob wrote: I was going to suggest either sending a `shared(TS*)` or receiving a `shared(T)*`. But it looks like you can't send a shared pointer. When I tried, it got turned into a unshared-pointer-to-shared on

sending shared pointer to struct. message type mismatch

2016-04-21 Thread jacob via Digitalmars-d-learn
Hello! I try to send shared pointer to struct: [code] import std.stdio; import std.concurrency; shared struct S(T, uint M) { T[M] x; } shared struct M { int x; } private void runner(T)() { shared(T*) s = receiveOnly!(shared(T*))(); writeln(s.x.length);

trying to implement lock-free fixedsize queue

2016-03-31 Thread jacob via Digitalmars-d-learn
I try to implement chunk (something like lock-free fixedsize queue) -- import core.atomic; shared struct Chunk(T, uint N) { shared T[N] data; shared uint count; shared uint queueCounter; @property uint capacity() { return N; } @property uint count() {

Re: How to setup mono-D for shared libraries?

2015-09-24 Thread Jacob via Digitalmars-d-learn
On Wednesday, 23 September 2015 at 04:34:45 UTC, Rikki Cattermole wrote: On 23/09/15 8:20 AM, Jacob wrote: How do I setup mono-D for creating shared libraries and including them into other projects? When I drag the .d files to create the library from, which is not my own, I get undefined

How to setup mono-D for shared libraries?

2015-09-22 Thread Jacob via Digitalmars-d-learn
How do I setup mono-D for creating shared libraries and including them into other projects? When I drag the .d files to create the library from, which is not my own, I get undefined references. I have the lib files, which are a bunch of separate libs, that I want to include into one big lib.