Re: filtering a row of a jagged array

2019-08-11 Thread Ali Çehreli via Digitalmars-d-learn
On 08/11/2019 09:43 AM, DanielG wrote: such a simple error You're not alone. We want this bug fixed: https://issues.dlang.org/show_bug.cgi?id=17263 Ali

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread Alex via Digitalmars-d-learn
On Sunday, 11 August 2019 at 20:32:14 UTC, John Colvin wrote: As I see this, everything you wrote is correct. :) But you compared abstractness with interface usage, initially. So... I would say, interfaces are more like the abstract method case without any function body. But then, you will

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, August 11, 2019 2:32:14 PM MDT John Colvin via Digitalmars-d- learn wrote: > On Sunday, 11 August 2019 at 20:15:34 UTC, Alex wrote: > > As I see this, everything you wrote is correct. :) > > > > But you compared abstractness with interface usage, initially. > > So... I would say,

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 11 August 2019 at 20:32:14 UTC, John Colvin wrote: E.g. why can I not inherit from multiple 100% abstract empty classes? Wouldn't that be the same as inheriting from multiple interfaces? There's kinda no such thing as 100% empty abstract classes, since they all have the implicit

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread John Colvin via Digitalmars-d-learn
On Sunday, 11 August 2019 at 20:15:34 UTC, Alex wrote: On Sunday, 11 August 2019 at 16:05:20 UTC, John Colvin wrote: I'm trying to narrow down exactly what patterns work with each and how they overlap. What I was trying to get at with the abstract method thing is that abstract class C {

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread Alex via Digitalmars-d-learn
On Sunday, 11 August 2019 at 16:05:20 UTC, John Colvin wrote: I'm trying to narrow down exactly what patterns work with each and how they overlap. What I was trying to get at with the abstract method thing is that abstract class C { void foo(); } is an abstract class with a

Re: CT filtering of class members

2019-08-11 Thread Sjoerd Nijboer via Digitalmars-d-learn
On Sunday, 11 August 2019 at 16:32:20 UTC, Simen Kjærås wrote: [...] Something like this: import std.meta : Filter; import std.traits : isFunction; import std.algorithm.searching : canFind; enum isNonspecialMemberFunction(string name) = !ctorAndDtor.canFind(name) &&

Re: filtering a row of a jagged array

2019-08-11 Thread DanielG via Digitalmars-d-learn
Thank you both! Ugh, I have to roll my eyes at missing such a simple error. (This literally occurred in the context of a bunch of other code using 'map' and 'reduce' with the exclamation point, so I don't know why my brain turned off for 'filter') Thanks again!

Re: filtering a row of a jagged array

2019-08-11 Thread Simen Kjærås via Digitalmars-d-learn
On Sunday, 11 August 2019 at 16:11:15 UTC, DanielG wrote: int[][] whatever = [ [0], [0, 1, 2], [5, 6, 7, 8, 9, 10] ]; writeln(whatever[2]);// [5, 6, 7, 8, 9, 10] writeln(typeid(whatever[2]));// int[] auto x = whatever[2].filter(x => x > 7); // error

Re: filtering a row of a jagged array

2019-08-11 Thread ag0aep6g via Digitalmars-d-learn
On 11.08.19 18:11, DanielG wrote: auto x = whatever[2].filter(x => x > 7); // error You just forgot an exclamation mark here. auto x = whatever[2].filter!(x => x > 7); // works

Re: CT filtering of class members

2019-08-11 Thread Simen Kjærås via Digitalmars-d-learn
On Sunday, 11 August 2019 at 15:27:54 UTC, Sjoerd Nijboer wrote: The following snippet doesn't compile I am trying to reflect on a class and only do an operation with all member functions of a class. But I can't seem to use a filter to only get the member functions out of a type T. I

filtering a row of a jagged array

2019-08-11 Thread DanielG via Digitalmars-d-learn
int[][] whatever = [ [0], [0, 1, 2], [5, 6, 7, 8, 9, 10] ]; writeln(whatever[2]);// [5, 6, 7, 8, 9, 10] writeln(typeid(whatever[2]));// int[] auto x = whatever[2].filter(x => x > 7); // error Error: template std.algorithm.iteration.filter cannot deduce

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread John Colvin via Digitalmars-d-learn
On Sunday, 11 August 2019 at 15:16:03 UTC, Alex wrote: On Sunday, 11 August 2019 at 13:09:43 UTC, John Colvin wrote: Ok. What would go wrong (in D) if I just replaced every interface with an abstract class? I think there's some confusion here, because B.foo is not abstract. abstract on a

CT filtering of class members

2019-08-11 Thread Sjoerd Nijboer via Digitalmars-d-learn
The following snippet doesn't compile I am trying to reflect on a class and only do an operation with all member functions of a class. But I can't seem to use a filter to only get the member functions out of a type T. I understand that there are two errors in my snippet. 1) It cannot mixin a

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread Alex via Digitalmars-d-learn
On Sunday, 11 August 2019 at 13:09:43 UTC, John Colvin wrote: Ok. What would go wrong (in D) if I just replaced every interface with an abstract class? I think there's some confusion here, because B.foo is not abstract. abstract on a class is not inherited by its methods.

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread John Colvin via Digitalmars-d-learn
On Saturday, 10 August 2019 at 17:28:32 UTC, Alex wrote: ´´´ void main(){} interface A { void fun(); } abstract class B{ void fun(); } class C : A{ void fun(){} } class D : B{ /*override*/ void fun(){} } ´´´ case 1: interface A and class C implementing interface A: You don't need to "override"

Re: Abstract classes vs interfaces, casting from void*

2019-08-11 Thread John Colvin via Digitalmars-d-learn
On Saturday, 10 August 2019 at 17:46:37 UTC, Timon Gehr wrote: On 10.08.19 16:29, John Colvin wrote: Ok. What would go wrong (in D) if I just replaced every interface with an abstract class? interface A{} interface B{} class C: A,B{ } Yes, I know, I guess it wasn't clear unless you read

Re: How to run the dub bundle with dmd

2019-08-11 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 10 August 2019 at 16:44:48 UTC, greatsam4sure wrote: On Saturday, 10 August 2019 at 15:42:39 UTC, rikki cattermole wrote: This is a crazy question but is your Windows install 64bit? yes. See the spec below https://ibb.co/M1TwY7W I am currently assuming it is not a general