Re: Sturcts with constructor (dmd1.x)

2010-01-12 Thread Nrgyzer
dsimcha Wrote: > == Quote from Nrgyzer (nrgy...@googlemail.com)'s article > > Hello everyone, > > I currently try to create a structure with a construtor, but I always get > > the > following messages: > > Error: Foo.this constructors are only for class definitions > > Error: constructor lisim.ls

Re: Sturcts with constructor (dmd1.x)

2010-01-12 Thread Strtr
bearophile Wrote: > Strtr: > > How much of an overhead is a call to a struct instance compared to a call > > to a object? > > The situation is more complex than that. Structs don't have a pointer to the > virtual table and monitor, that saves memory and time. Less memory saves you > time if yo

Re: Sturcts with constructor (dmd1.x)

2010-01-12 Thread bearophile
Strtr: > How much of an overhead is a call to a struct instance compared to a call to > a object? The situation is more complex than that. Structs don't have a pointer to the virtual table and monitor, that saves memory and time. Less memory saves you time if you have to allocate a large number

Re: Sturcts with constructor (dmd1.x)

2010-01-12 Thread Strtr
bearophile Wrote: > grauzone: > > > Struct constructors are probably the D2 feature I miss more in D1 :-) > > > > Why? > > During optimization phases I sometimes want to convert classes into structs, > and then I want to allocate some of those struct instances on the heap and > others on the s

Re: Sturcts with constructor (dmd1.x)

2010-01-12 Thread bearophile
grauzone: > > Struct constructors are probably the D2 feature I miss more in D1 :-) > > Why? During optimization phases I sometimes want to convert classes into structs, and then I want to allocate some of those struct instances on the heap and others on the stack. A struct constructor allows m

Re: Sturcts with constructor (dmd1.x)

2010-01-11 Thread grauzone
bearophile wrote: dsimcha: Struct constructors are D2 only. That said, you can fake them in D1 by overloading static opCall: Struct constructors are probably the D2 feature I miss more in D1 :-) Why? Bye, bearophile

Re: Sturcts with constructor (dmd1.x)

2010-01-11 Thread bearophile
dsimcha: > Struct constructors are D2 only. That said, you can fake them in D1 by > overloading static opCall: Struct constructors are probably the D2 feature I miss more in D1 :-) Bye, bearophile

Re: Sturcts with constructor (dmd1.x)

2010-01-11 Thread Ellery Newcomer
On 01/11/2010 04:06 PM, Nrgyzer wrote: Hello everyone, I currently try to create a structure with a construtor, but I always get the following messages: Error: Foo.this constructors are only for class definitions Error: constructor lisim.lsResult.lsResult.this special member functions not all

Re: Sturcts with constructor (dmd1.x)

2010-01-11 Thread dsimcha
== Quote from Nrgyzer (nrgy...@googlemail.com)'s article > Hello everyone, > I currently try to create a structure with a construtor, but I always get the following messages: > Error: Foo.this constructors are only for class definitions > Error: constructor lisim.lsResult.lsResult.this special memb

Sturcts with constructor (dmd1.x)

2010-01-11 Thread Nrgyzer
Hello everyone, I currently try to create a structure with a construtor, but I always get the following messages: Error: Foo.this constructors are only for class definitions Error: constructor lisim.lsResult.lsResult.this special member functions not allowed for structs By compiling the follwi