Re: At compile time

2009-08-21 Thread bearophile
Don: >Using CTFE will be a completely different experience after the next release.< What kind of limits do you want to lift? :-) I think now LDC uses a compile-time garbage collector (beside the second one in the D runtime and the third one used by LLVM), so using CTFE&templates is better alrea

Re: Structs by ref in D2

2009-08-21 Thread bearophile
Daniel Keep: > In my own code, I usually record my intent by using "inout" for > variables I intend to modify and "ref" for ones which I don't. > Always seemed reasonable to me. for the compiler they mean the same thing, but inout is being deprecated. Bye, bearophile

Re: Template mixins: Why is the decision to mixin made at the call site?

2009-08-21 Thread Steven Schveighoffer
On Fri, 21 Aug 2009 13:54:38 -0400, div0 wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jarrett Billingsley wrote: On Fri, Aug 21, 2009 at 1:36 PM, div0 wrote: That's what he's suggesting, and it does make sense. When you write a template, *either* it's meant to be used as a mixin,

Re: Template mixins: Why is the decision to mixin made at the call site?

2009-08-21 Thread Ary Borenszweig
div0 wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ary Borenszweig wrote: div0 wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jarrett Billingsley wrote: On Fri, Aug 21, 2009 at 1:36 PM, div0 wrote: That's what he's suggesting, and it does make sense. When you write a template,

Re: Template mixins: Why is the decision to mixin made at the call site?

2009-08-21 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ary Borenszweig wrote: > div0 wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Jarrett Billingsley wrote: >>> On Fri, Aug 21, 2009 at 1:36 PM, div0 wrote: >>> >>> That's what he's suggesting, and it does make sense. When you write a >>

Re: Template mixins: Why is the decision to mixin made at the call site?

2009-08-21 Thread Ary Borenszweig
div0 wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jarrett Billingsley wrote: On Fri, Aug 21, 2009 at 1:36 PM, div0 wrote: That's what he's suggesting, and it does make sense. When you write a template, *either* it's meant to be used as a mixin, *or* it's meant to be used some other wa

Re: Template mixins: Why is the decision to mixin made at the call site?

2009-08-21 Thread Bill Baxter
On Fri, Aug 21, 2009 at 10:36 AM, div0 wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Chad J wrote: >> Regarding template mixins, I'm curious, why is the decision to mixin a >> template made at the call site and not at the declaration of the >> template/mixin? >> >> In other words, wh

Re: Template mixins: Why is the decision to mixin made at the call site?

2009-08-21 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jarrett Billingsley wrote: > On Fri, Aug 21, 2009 at 1:36 PM, div0 wrote: > > That's what he's suggesting, and it does make sense. When you write a > template, *either* it's meant to be used as a mixin, *or* it's meant > to be used some other way. Mi

Re: Export static data

2009-08-21 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jarrett Billingsley wrote: > On Fri, Aug 21, 2009 at 11:10 AM, Dan wrote: >> Is there a way to export static data from a DLL written in D? >> >> I'd like to write some extension DLLs for a program, but they need to have >> certain static data exports

Re: Template mixins: Why is the decision to mixin made at the call site?

2009-08-21 Thread Jarrett Billingsley
On Fri, Aug 21, 2009 at 1:36 PM, div0 wrote: > Not sure what the original choice was based on, but what you suggest > looks wrong to me. You aren't necessarily using a template in order to > mix it in somewhere. > > With that syntax it looks like you can only use foo as a mixin. That's what he's s

Re: Template mixins: Why is the decision to mixin made at the call site?

2009-08-21 Thread div0
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chad J wrote: > Regarding template mixins, I'm curious, why is the decision to mixin a > template made at the call site and not at the declaration of the > template/mixin? > > In other words, why do we write > > template foo() > { >

Re: alias foo.bar this?

2009-08-21 Thread Bill Baxter
On Fri, Aug 21, 2009 at 2:47 AM, Lutger wrote: > The following doesn't compile, I was wondering whether this is a temporary > limitation, bug or by design? > > struct Bar > { >    int baz; > } > > struct Foo > { >    Bar bar; >    alias bar.baz this; // error > } Problem I would guess is that bar.

Re: Export static data

2009-08-21 Thread Jarrett Billingsley
On Fri, Aug 21, 2009 at 11:10 AM, Dan wrote: > Is there a way to export static data from a DLL written in D? > > I'd like to write some extension DLLs for a program, but they need to have > certain static data exports to be recognized. I've been able to export > functions, but no data appears in

Re: Structs by ref in D2

2009-08-21 Thread Daniel Keep
Steven Schveighoffer wrote: > ... > > The issue is possibly with ref. There are two reasons to use ref, 1 is > to be able to change the data referenced, 2 is for passing speed. > > 1 is bad for rvalues. 2 should be ok for rvalues. > > If there was a way to signify you only want to use ref fo

Export static data

2009-08-21 Thread Dan
Is there a way to export static data from a DLL written in D? I'd like to write some extension DLLs for a program, but they need to have certain static data exports to be recognized. I've been able to export functions, but no data appears in the export table of the DLL. In MSVC 6 I can do it as

Re: Structs by ref in D2

2009-08-21 Thread Steven Schveighoffer
On Fri, 21 Aug 2009 10:42:08 -0400, Daniel Keep wrote: Lutger wrote: By const ref seems reasonable to allow, but by ref is bug prone. Why is it handy? struct Vector4 { float[4] xyzw; Vector opAdd(ref Vector rhs); } Vector code can be made much faster using ref arguments, but i

Re: Structs by ref in D2

2009-08-21 Thread bearophile
Daniel Keep: >Vector code can be made much faster using ref arguments,< You are right regarding DMD (that's what I was asking for), but LDC often is able to inline everything (if the method is short), so using ref leads to the same (high) performance. Bye, bearophile

Re: Structs by ref in D2

2009-08-21 Thread Daniel Keep
Lutger wrote: > By const ref seems reasonable to allow, but by ref is bug prone. Why is it > handy? struct Vector4 { float[4] xyzw; Vector opAdd(ref Vector rhs); } Vector code can be made much faster using ref arguments, but if you use ref arguments, you can't have anything more compl

Re: At compile time

2009-08-21 Thread Lars T. Kyllingstad
Don wrote: Lars T. Kyllingstad wrote: Don wrote: Jarrett Billingsley wrote: I don't think you can call struct methods at compile-time. Kind of lame, I know. Try making norm a free function. Can the D2 compiler modified/improved to allow this? It sure would be nice. In fact the D1 compi

Re: At compile time

2009-08-21 Thread Don
Lars T. Kyllingstad wrote: Don wrote: Jarrett Billingsley wrote: I don't think you can call struct methods at compile-time. Kind of lame, I know. Try making norm a free function. Can the D2 compiler modified/improved to allow this? It sure would be nice. In fact the D1 compiler should s

Re: Structs by ref in D2

2009-08-21 Thread Lutger
By const ref seems reasonable to allow, but by ref is bug prone. Why is it handy?

alias foo.bar this?

2009-08-21 Thread Lutger
The following doesn't compile, I was wondering whether this is a temporary limitation, bug or by design? struct Bar { int baz; } struct Foo { Bar bar; alias bar.baz this; // error }