Re: DMD test suite assertion failure in test_cdvecfill.d

2017-11-25 Thread Michael V. Franklin via Digitalmars-d-learn
On Tuesday, 21 November 2017 at 10:04:50 UTC, Petar Kirov [ZombineDev] wrote: File a bug report and try contacting Martin Nowak, as he's the author of this test, IIRC. https://issues.dlang.org/show_bug.cgi?id=18013

Re: inout after function

2017-11-25 Thread Dave Jones via Digitalmars-d-learn
On Saturday, 25 November 2017 at 21:59:54 UTC, Ali Çehreli wrote: On 11/25/2017 01:51 PM, Dave Jones wrote: > What does the "inout" after front() do here... > > > @property ref inout(T) front() inout > { > assert(_data.refCountedStore.isInitialized); > return _data._payload[0]; > } > >

Re: inout after function

2017-11-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 26 November 2017 at 01:35:01 UTC, Dave Jones wrote: So it makes it a const/immutable/mutable method depending on whether the instance it is called on is const/immutable/mutable? On the outside, yes. So @property ref inout(int) front() inout { return i++; }

Re: Is variable void?

2017-11-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 25 November 2017 at 15:34:21 UTC, John Chapman wrote: Is there any way of determining whether a variable has been initialized or not? For example, if something is declared like this: nope. It'd be indistinguishable from the user just happening to initialize it to some random

Re: Floating point types default to NaN?

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
Nonetheless, my original question was answered. Thanks for the insights!

Re: Floating point types default to NaN?

2017-11-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 25 November 2017 at 16:16:52 UTC, A Guy With a Question wrote: If D chooses it's defaults to make errors stick out, why not just error at declaration if they don't explicitly set it to something. It technically did: https://dlang.org/spec/function.html#local-variables "It is an

Re: Linking multiple libraries

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:31:10 UTC, Mike Parker wrote: On Saturday, 25 November 2017 at 22:18:52 UTC, A Guy With a Question wrote: That's how I set up the linking in Visual D. Everything builds. But should the final exe try to link against all 3 libraries, library 3 link to

Re: Is variable void?

2017-11-25 Thread John Chapman via Digitalmars-d-learn
On Saturday, 25 November 2017 at 15:38:15 UTC, Adam D. Ruppe wrote: nope. It'd be indistinguishable from the user just happening to initialize it to some random value. Thanks. I'll got with .init instead.

Re: Is variable void?

2017-11-25 Thread rikki cattermole via Digitalmars-d-learn
On 25/11/2017 3:34 PM, John Chapman wrote: Is there any way of determining whether a variable has been initialized or not? For example, if something is declared like this:   int x = void; can I check if it's void before I use it, say, in a function it's been passed to? `` = void;`` isn't

Linking multiple libraries

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
Hi, So I got this working, I would just like to see if I have done this correctly or if it's just working out of a fluke. I am using Visual D. Lets say I have four projects: Library 1: Common Library Library 2: Base Service Library - Dependent on the Common Library. Library 3: More Specified

Re: Floating point types default to NaN?

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:13:43 UTC, Adam D. Ruppe wrote: On Saturday, 25 November 2017 at 16:16:52 UTC, A Guy With a Question wrote: If D chooses it's defaults to make errors stick out, why not just error at declaration if they don't explicitly set it to something. It technically

Re: reduce condition nesting

2017-11-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:45:03 UTC, Ali Çehreli wrote: Despite 'lazy', apparently my failed attempt had eager arguments: void when(lazy bool[] args...) { Yeah, I'm tempted to say that is a bug... I doubt anyone has combined lazy with T[]... like this before - especially since the

Is variable void?

2017-11-25 Thread John Chapman via Digitalmars-d-learn
Is there any way of determining whether a variable has been initialized or not? For example, if something is declared like this: int x = void; can I check if it's void before I use it, say, in a function it's been passed to?

inout after function

2017-11-25 Thread Dave Jones via Digitalmars-d-learn
What does the "inout" after front() do here... @property ref inout(T) front() inout { assert(_data.refCountedStore.isInitialized); return _data._payload[0]; } Cant seem to find an explanation in the docs or forums :(

Re: Floating point types default to NaN?

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 09:39:15 UTC, Dave Jones wrote: On Friday, 24 November 2017 at 22:38:49 UTC, Jonathan M Davis wrote: On Friday, November 24, 2017 20:43:14 A Guy With a Question via Digitalmars- d-learn wrote: On Friday, 24 November 2017 at 14:43:24 UTC, Adam D. Ruppe That

Re: reduce condition nesting

2017-11-25 Thread Ali Çehreli via Digitalmars-d-learn
On 11/23/2017 06:16 AM, Andrea Fontana wrote: On Thursday, 23 November 2017 at 13:47:37 UTC, Adam D. Ruppe wrote: On Thursday, 23 November 2017 at 05:19:27 UTC, Andrey wrote: for instance in kotlin it can be replace with this: when {     c1 -> foo(),     c2 -> bar(),     c3 -> ...     else ->

Re: inout after function

2017-11-25 Thread Ali Çehreli via Digitalmars-d-learn
On 11/25/2017 01:51 PM, Dave Jones wrote: > What does the "inout" after front() do here... > > > @property ref inout(T) front() inout > { > assert(_data.refCountedStore.isInitialized); > return _data._payload[0]; > } > > Cant seem to find an explanation in the docs or forums :( It's

Re: Linking multiple libraries

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:36:32 UTC, A Guy With a Question wrote: On Saturday, 25 November 2017 at 22:31:10 UTC, Mike Parker wrote: On Saturday, 25 November 2017 at 22:18:52 UTC, A Guy With a Question wrote: That's how I set up the linking in Visual D. Everything builds. But

Re: inout after function

2017-11-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 25 November 2017 at 21:51:41 UTC, Dave Jones wrote: What does the "inout" after front() do here... Applies the `inout` modifier to the hidden `this` variable inside the function. https://dlang.org/spec/function.html#inout-functions It basically makes it const inside the

Re: Linking multiple libraries

2017-11-25 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:43:30 UTC, A Guy With a Question wrote: Actually ignore that last comment, they are producing libs not dlls. Funny how all three ways of linking work... On Windows, when building a DLL, compilers typically produce an "import library" alongside it, which

Re: reduce condition nesting

2017-11-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 25 November 2017 at 21:42:29 UTC, Ali Çehreli wrote: I tried to implement the following but gave up because I could not ensure short circuit behaviour. when( c1.then(foo()), c2.then(bar()), otherwise(zar()) ); Possible? Bones: "Perhaps the

Re: Linking multiple libraries

2017-11-25 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:18:52 UTC, A Guy With a Question wrote: That's how I set up the linking in Visual D. Everything builds. But should the final exe try to link against all 3 libraries, library 3 link to library 1 & 2 and library 2 link to library 1 (also builds)? Or is the

Re: Linking multiple libraries

2017-11-25 Thread A Guy With a Question via Digitalmars-d-learn
On Saturday, 25 November 2017 at 22:40:49 UTC, A Guy With a Question wrote: On Saturday, 25 November 2017 at 22:36:32 UTC, A Guy With a Question wrote: On Saturday, 25 November 2017 at 22:31:10 UTC, Mike Parker wrote: On Saturday, 25 November 2017 at 22:18:52 UTC, A Guy With a Question wrote:

Re: reduce condition nesting

2017-11-25 Thread Ali Çehreli via Digitalmars-d-learn
On 11/25/2017 02:05 PM, Adam D. Ruppe wrote: On Saturday, 25 November 2017 at 21:42:29 UTC, Ali Çehreli wrote: I tried to implement the following but gave up because I could not ensure short circuit behaviour.     when(     c1.then(foo()),     c2.then(bar()),     otherwise(zar())  

Re: Floating point types default to NaN?

2017-11-25 Thread Dave Jones via Digitalmars-d-learn
On Friday, 24 November 2017 at 22:38:49 UTC, Jonathan M Davis wrote: On Friday, November 24, 2017 20:43:14 A Guy With a Question via Digitalmars- d-learn wrote: On Friday, 24 November 2017 at 14:43:24 UTC, Adam D. Ruppe That requires data flow analysis, which the compiler doesn't do a lot of,

Re: Floating point types default to NaN?

2017-11-25 Thread Ola Fosheim Grøstad via Digitalmars-d-learn
On Friday, 24 November 2017 at 22:38:49 UTC, Jonathan M Davis wrote: That requires data flow analysis, which the compiler doesn't do a lot of, because it can be complicated. If dataflow is sufficient then it isn't all that complicated, you can implement generic dataflow using Monotone

Variadic Mixin/Template classes?

2017-11-25 Thread Chirs Forest via Digitalmars-d-learn
I'd like to make a class that takes multiple template types (1 - several) which can hold an array/tuple of a second class that are instantiated with those types. class Bar(T) { T bar; } class Foo(T[]){ // not sure how to take variadic types here? Bar!(?)[] bars; //not sure how I'd

Re: Variadic Mixin/Template classes?

2017-11-25 Thread vit via Digitalmars-d-learn
On Saturday, 25 November 2017 at 09:52:01 UTC, Chirs Forest wrote: I'd like to make a class that takes multiple template types (1 - several) which can hold an array/tuple of a second class that are instantiated with those types. class Bar(T) { T bar; } class Foo(T[]){ // not sure how to

Re: Variadic Mixin/Template classes?

2017-11-25 Thread Chirs Forest via Digitalmars-d-learn
On Saturday, 25 November 2017 at 10:08:36 UTC, vit wrote: On Saturday, 25 November 2017 at 09:52:01 UTC, Chirs Forest wrote: [...] import std.meta : staticMap; class Bar(T) { T bar; } class Foo(Ts...){ staticMap!(Bar, Ts) bars; this(){ static foreach(i, alias T; Ts)

Scalars in ndslice?

2017-11-25 Thread Saurabh Das via Digitalmars-d-learn
I've been using ndslice for some timeseries work and it's incredibly good. One question which I couldn't find an answer to: Can ndslice behave as a scalar (ie: 0-dimensional slice)? It would be convenient if that is possible since then I won't have to write different functions for scalars