Re: Compiler bug?

2017-08-15 Thread Daniel Kozak via Digitalmars-d-learn
and some doc: http://dlang.org/spec/function.html#function-inheritance On Wed, Aug 16, 2017 at 7:45 AM, Daniel Kozak wrote: > No it is not a bug, there is no s() in B, you can fix this by adding: > > alias s = A.s; > > to class B > > On Wed, Aug 16, 2017 at 7:21 AM, apz28 via

Re: Compiler bug?

2017-08-15 Thread Daniel Kozak via Digitalmars-d-learn
No it is not a bug, there is no s() in B, you can fix this by adding: alias s = A.s; to class B On Wed, Aug 16, 2017 at 7:21 AM, apz28 via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > abstract class A > { > string _s; > > @property: > final string s() >

Re: How to fix wrong deprecation message - dmd-2.075.1

2017-08-15 Thread Daniel Kozak via Digitalmars-d-learn
You should open an issue on https://issues.dlang.org/ until it is fixed you can use lazy variation byChar, byWchar or byUTF: void main() { import std.utf : byWchar; import std.array : array; wstring s = byWchar("abc").array; } On Wed, Aug 16, 2017 at 7:09 AM, apz28 via

Compiler bug?

2017-08-15 Thread apz28 via Digitalmars-d-learn
abstract class A { string _s; @property: final string s() { return _s; } A s(string x) { _s = x; return this; } } class B : A { @property: final override A s(string

How to fix wrong deprecation message - dmd-2.075.1

2017-08-15 Thread apz28 via Digitalmars-d-learn
void main() { import std.utf : toUTF16; // Same problem with toUTF8 wstring s = toUTF16!string("abc"); } Compilation output: /d500/f513.d(3): Deprecation: function std.utf.toUTF16 is deprecated - To be removed November 2017. Please use std.utf.encode instead.

Re: Issues with std.format template function

2017-08-15 Thread LeqxLeqx via Digitalmars-d-learn
On Tuesday, 15 August 2017 at 05:22:44 UTC, HyperParrow wrote: On Tuesday, 15 August 2017 at 04:44:25 UTC, LeqxLeqx wrote: [...] GDC front-end is based on DMD 2.068.2 but the feature you use (format specifier as template parameter) is only there since DMD 2.075. The error comes from the

Re: WebCam or Video in D

2017-08-15 Thread brian via Digitalmars-d-learn
On Monday, 14 August 2017 at 13:19:30 UTC, Guillaume Piolat wrote: It wouldn't be very hard to write a minimal OpenCV loader (for example based on DerelictUtil) with only the few functions you need in OpenCV. Do you know of any simple examples that I could try mimic? I've looked through

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/15/17 5:27 PM, Arek wrote: On Tuesday, 15 August 2017 at 10:37:08 UTC, Kagamin wrote: Well, no wrapper is actually needed here: class A { int method() shared; } void consumer() { shared a = receiveOnly!(shared A)(); } void producer() { auto cons = spawn(); send(cons, new

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-15 Thread Arek via Digitalmars-d-learn
On Tuesday, 15 August 2017 at 10:37:08 UTC, Kagamin wrote: Well, no wrapper is actually needed here: class A { int method() shared; } void consumer() { shared a = receiveOnly!(shared A)(); } void producer() { auto cons = spawn(); send(cons, new shared A()); }

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/15/17 10:42 AM, Kagamin wrote: https://github.com/dlang/phobos/blob/master/std/variant.d#L623 memcpy(, cast(const(void*)) , rhs.sizeof); should be ok to cast unconditionally Agreed, the T value being copied has already been copied onto the stack, so it's not really shared. However,

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-15 Thread Kagamin via Digitalmars-d-learn
https://github.com/dlang/phobos/blob/master/std/variant.d#L623 memcpy(, cast(const(void*)) , rhs.sizeof); should be ok to cast unconditionally

Re: How to specify a template that uses unqualified type, like any normal function

2017-08-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/14/17 6:27 PM, Jonathan M Davis via Digitalmars-d-learn wrote: As I understand it, sufficiently smart C++ compilers will figure out that the code for two template instantiations can be the same even if the types aren't, and they'll merge the definitions in the generated code, so you only

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/14/17 5:27 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Monday, August 14, 2017 15:22:23 Steven Schveighoffer via Digitalmars-d- learn wrote: On 8/13/17 11:40 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Saturday, August 12, 2017 18:57:44 Arek via Digitalmars-d-learn

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-15 Thread Kagamin via Digitalmars-d-learn
Well, no wrapper is actually needed here: class A { int method() shared; } void consumer() { shared a = receiveOnly!(shared A)(); } void producer() { auto cons = spawn(); send(cons, new shared A()); }

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-15 Thread Kagamin via Digitalmars-d-learn
On Monday, 14 August 2017 at 22:22:58 UTC, Arek wrote: I've found some simple workaround for this problem: import std.stdio; import std.concurrency; struct Envelope(T) if (is(T == class)) // for simplicity of this example, only classes { shared(T)[] obj; this(shared T o)

Re: Does anyone understand how to use "shared" types with concurrency send/receive functions?

2017-08-15 Thread Kagamin via Digitalmars-d-learn
On Monday, 14 August 2017 at 20:13:28 UTC, Arek wrote: If I can ensure the uniqueness of the object, there is no need to "share" it or synchronize the access. You use manually managed multithreading, that's why you need shared. And because compiler can't verify uniqueness, you are requested