Re: Difference between stack-allocated class and struct

2011-05-02 Thread Sean Cavanaugh
Here is my prototype COM compile-time reflection based wrapper mixin (which I have abandoned in favor of alias this since it covers 95% of my use cases even though it isn't perfectly safe). I am new at D so you have been warned, though this part of the language seems pretty straightforward eno

Re: Difference between stack-allocated class and struct

2011-05-02 Thread Piotr Szturmaj
Mariusz Gliwiński wrote: I'll clarify myself: All i would need is extending - without polymorphism. Containment, can be solution for fields which doesn't annoys so much (although image in auto-generated documentation, just like it's with subclassing, would be nice). Unfortunately, the worse case

Re: Difference between stack-allocated class and struct

2011-05-02 Thread Jonathan M Davis
> Firstly, thanks for comprehensive answer and I'd like to excuse for my > stupid mistakes, which are caused by learning a lot and not actually > programming. > > On date 2011-05-02 23:03, Jonathan M Davis wrote: > > Classes are reference types and are meant to be on the heap. > > Yeah, value vs

Re: Difference between stack-allocated class and struct

2011-05-02 Thread Mariusz Gliwiński
Firstly, thanks for comprehensive answer and I'd like to excuse for my stupid mistakes, which are caused by learning a lot and not actually programming. On date 2011-05-02 23:03, Jonathan M Davis wrote: Classes are reference types and are meant to be on the heap. Yeah, value vs reference sema

Re: Difference between stack-allocated class and struct

2011-05-02 Thread Jonathan M Davis
> What are the differences between class instantiated by scope and struct > itself? > Two, that comes to my mind are: > - vtable existance (yep, struct with inheritation - that's what i like) > - lol, i just forgot while writing this e-mail First off, I would point out that scoped classes are goin

Difference between stack-allocated class and struct

2011-05-02 Thread Mariusz Gliwiński
What are the differences between class instantiated by scope and struct itself? Two, that comes to my mind are: - vtable existance (yep, struct with inheritation - that's what i like) - lol, i just forgot while writing this e-mail :) Sincerely, Mariusz Gliwiński

Re: expression templates

2011-05-02 Thread Don
Mr enuhtac wrote: Hello everyone, I'm new to D and this list (although I've had a look onto D a few years ago). I hope you guys can help me with my questions. At the moment I'm trying to implement some expression template stuff. My first goal is to encode an expression into a type representin

Re: opDollar()

2011-05-02 Thread Don
Dmitry Olshansky wrote: On 26.03.2011 11:03, Caligo wrote: "In the expression a[, ...,], if $ occurs in, it is rewritten as a.opDollar!(i)()." -- TDPL, pg 380 Is that correct? if so, could some one give an example code? I don't understand the need for the parameter. Also, what is the signatu

Re: What is put() useful for with regards to dynamic arrays?

2011-05-02 Thread Andrej Mitrovic
Thanks, that post explained it. Obviously I wasn't the first and likely won't be the last person to run into this. Maybe put's documentation could make a note of this.

Re: "not an lvalue"

2011-05-02 Thread Steven Schveighoffer
On Sun, 01 May 2011 09:30:34 -0400, CrypticMetaphor wrote: Hi, I've been away from D for a while, but now I'm back and I'm stuck with an compile time error. I've got a Matrix33 class and a Vector3 class, but something is wrong with the way I return my Vector3 in my matrix class: If I d

Re: Matrix creation quiz

2011-05-02 Thread bearophile
I was away. Don: > That would not fix this problem. You're doing arithmetic on unsigned > values, where overflow doesn't happen. My enhancement request about integral overflows asks for two compiler switches: one that turns signed integral overflows (at compile time or run time) into errors,

Re: What is put() useful for with regards to dynamic arrays?

2011-05-02 Thread Lars T. Kyllingstad
On Sat, 30 Apr 2011 00:09:09 -0400, Andrej Mitrovic wrote: > import std.range; > > void main() > { > int[] a = [1, 2, 3]; > > a.put(6); > assert(a == [2, 3]); > > a.put([1, 2]); > assert(a.length == 0); > } > > Seems kind of odd.. put is implemented as an append met