Re: Template-style polymorphism in table structure

2016-09-04 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 4 September 2016 at 14:49:30 UTC, Lodovico Giaretta wrote: Your getCol(i) could become getCol!T(i) and return an instance of GenericVector!T directly, after checking that the required column has in fact that type: GenericVector!T getCol!T(size_t i) { if(typeid(cols[i]) == typeid

Re: Using OpenGL

2016-09-04 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 3 September 2016 at 17:13:49 UTC, Darren wrote: On Saturday, 3 September 2016 at 16:07:52 UTC, Mike Parker wrote: [...] The dynamic array! Thank you so much, I changed that on another file and it finally drew the triangle. And I ran your code and it works brilliantly. I shoul

Re: What is this behavior and how do I disable or get around it?

2016-09-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, September 05, 2016 00:26:01 pineapple via Digitalmars-d-learn wrote: > This program does not compile. > > Error: cannot implicitly convert expression (cast(int)x - > cast(int)x) of type int to ubyte > > void main(){ > ubyte x; > x = x - x; > } > > I don't eve

Re: What is this behavior and how do I disable or get around it?

2016-09-04 Thread Mike Parker via Digitalmars-d-learn
On Monday, 5 September 2016 at 00:26:01 UTC, pineapple wrote: This program does not compile. Error: cannot implicitly convert expression (cast(int)x - cast(int)x) of type int to ubyte void main(){ ubyte x; x = x - x; } I don't even know what to say. Who thought this b

Re: Keen to learn D

2016-09-04 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 4 September 2016 at 20:12:09 UTC, Abhishek Mishra wrote: Hi! I am a newbie and I would like to know more about D language. I have prior knowledge of C++(12th Grade/ Pre-University College Level). How should I start? What more do I need to learn. Thanks in advance. :) in addition to

Re: Keen to learn D

2016-09-04 Thread bachmeier via Digitalmars-d-learn
On Sunday, 4 September 2016 at 20:12:09 UTC, Abhishek Mishra wrote: Hi! I am a newbie and I would like to know more about D language. I have prior knowledge of C++(12th Grade/ Pre-University College Level). How should I start? What more do I need to learn. Thanks in advance. :) Ali's book can

Re: What is this behavior and how do I disable or get around it?

2016-09-04 Thread ak via Digitalmars-d-learn
On Monday, 5 September 2016 at 00:26:01 UTC, pineapple wrote: This program does not compile. Error: cannot implicitly convert expression (cast(int)x - cast(int)x) of type int to ubyte void main(){ ubyte x; x = x - x; } I don't even know what to say. Who thought this b

What is this behavior and how do I disable or get around it?

2016-09-04 Thread pineapple via Digitalmars-d-learn
This program does not compile. Error: cannot implicitly convert expression (cast(int)x - cast(int)x) of type int to ubyte void main(){ ubyte x; x = x - x; } I don't even know what to say. Who thought this behavior was a good idea?

Re: Hash table element existence check

2016-09-04 Thread Illuminati via Digitalmars-d-learn
On Saturday, 3 September 2016 at 14:07:27 UTC, Cauterite wrote: On Saturday, 3 September 2016 at 12:33:26 UTC, Illuminati wrote: On Saturday, 3 September 2016 at 07:44:28 UTC, Cauterite wrote: On Friday, 2 September 2016 at 19:38:34 UTC, Illuminati wrote: I am trying to create a hash table and

Re: How compiler detects forward reference errors

2016-09-04 Thread Illuminati via Digitalmars-d-learn
On Sunday, 4 September 2016 at 19:15:15 UTC, Igor wrote: On Saturday, 3 September 2016 at 14:13:27 UTC, Lodovico Giaretta wrote: On Saturday, 3 September 2016 at 14:06:06 UTC, Igor wrote: Can anyone explain in plain English how does compiler process and detect a "test.d(6) Error: forward refere

Re: Keen to learn D

2016-09-04 Thread szymski via Digitalmars-d-learn
You should take a look at this: http://tour.dlang.io/

Keen to learn D

2016-09-04 Thread Abhishek Mishra via Digitalmars-d-learn
Hi! I am a newbie and I would like to know more about D language. I have prior knowledge of C++(12th Grade/ Pre-University College Level). How should I start? What more do I need to learn. Thanks in advance. :)

Re: How compiler detects forward reference errors

2016-09-04 Thread Lodovico Giaretta via Digitalmars-d-learn
On Sunday, 4 September 2016 at 19:15:15 UTC, Igor wrote: So, you are saying compiler is keeping a kind of linked list of dependencies and then checks if any of those lists are circular? But how exactly would that list be structured since one expression can have multiple dependencies, like: en

Re: How compiler detects forward reference errors

2016-09-04 Thread Igor via Digitalmars-d-learn
On Saturday, 3 September 2016 at 14:13:27 UTC, Lodovico Giaretta wrote: On Saturday, 3 September 2016 at 14:06:06 UTC, Igor wrote: Can anyone explain in plain English how does compiler process and detect a "test.d(6) Error: forward reference of variable a" in following code: import std.stdio;

Re: Template-style polymorphism in table structure

2016-09-04 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 4 September 2016 at 14:49:30 UTC, Lodovico Giaretta wrote: On Sunday, 4 September 2016 at 14:24:12 UTC, data pulverizer wrote: On Sunday, 4 September 2016 at 14:20:24 UTC, data pulverizer wrote: @Lodovico Giaretta BTW what do you mean that my code is not very D style? Please expand o

Re: Template-style polymorphism in table structure

2016-09-04 Thread Lodovico Giaretta via Digitalmars-d-learn
On Sunday, 4 September 2016 at 14:24:12 UTC, data pulverizer wrote: On Sunday, 4 September 2016 at 14:20:24 UTC, data pulverizer wrote: On Sunday, 4 September 2016 at 14:07:54 UTC, data pulverizer wrote: @Lodovico Giaretta Thanks I just saw your update! @Lodovico Giaretta BTW what do you mean

Re: Template-style polymorphism in table structure

2016-09-04 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 4 September 2016 at 14:02:03 UTC, Lodovico Giaretta wrote: Your code is not very D style ... Well I guess I could have contracted the multiple constructors in GenericVector(T) and and DataFrame?

Re: Template-style polymorphism in table structure

2016-09-04 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 4 September 2016 at 14:07:54 UTC, data pulverizer wrote: @Lodovico Giaretta Thanks I just saw your update!

Re: Template-style polymorphism in table structure

2016-09-04 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 4 September 2016 at 14:20:24 UTC, data pulverizer wrote: On Sunday, 4 September 2016 at 14:07:54 UTC, data pulverizer wrote: @Lodovico Giaretta Thanks I just saw your update! @Lodovico Giaretta BTW what do you mean that my code is not very D style? Please expand on this ...

Re: Template-style polymorphism in table structure

2016-09-04 Thread data pulverizer via Digitalmars-d-learn
On Sunday, 4 September 2016 at 09:55:53 UTC, data pulverizer wrote: My main question is how to return GenericVector!(T) from the getCol() method in the Table class instead of BaseVector. I think I just solved my own query, change the BaseVector interface to a class and override it in the Gener

Re: Template-style polymorphism in table structure

2016-09-04 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 4 September 2016 at 09:55:53 UTC, data pulverizer wrote: I am trying to build a data table object with unrestricted column types. The approach I am taking is to build a generic interface BaseVector class and then a subtype GenericVector(T) which inherits from the BaseVector. I then t

Re: Template-style polymorphism in table structure

2016-09-04 Thread Lodovico Giaretta via Digitalmars-d-learn
On Sunday, 4 September 2016 at 09:55:53 UTC, data pulverizer wrote: [...] Your code is not very D style and, based on your needs, there may be better ways to achieve your goal, but without knowing your use case, it's difficult to give correct advice. Talking about that writeln statement, yo

Template-style polymorphism in table structure

2016-09-04 Thread data pulverizer via Digitalmars-d-learn
I am trying to build a data table object with unrestricted column types. The approach I am taking is to build a generic interface BaseVector class and then a subtype GenericVector(T) which inherits from the BaseVector. I then to build a Table class which contains columns that is a BaseVector ar