Applying const to an object but not the container (D 2.0)

2009-05-23 Thread Burton Radons
I'm writing an XML class. There are two tests for this class, isAncestorOf and isDescendantOf, that are implemented in terms of one another. They're both const, and look like this: class Node { Node parentNode; /// ... /// Return whether this is an ancestor of the other

Re: Making pure functions get dirty (D 2.0)

2009-02-20 Thread Burton Radons
Oh I see what's going on. pure functions get funky processing; if you don't actually use their return values they're not even compiled. Once you actually take the return value it'll complain about it whether it's a pure inner function in a pure outer function or anything else unless if it's a pu

Making pure functions get dirty (D 2.0)

2009-02-20 Thread Burton Radons
I'm writing a general conversion template function a la: pure T convert (T, U) (const (U) value); Sweet, and really handy for template errors because you can tell the user which number input it is that angered it. The problem is that if you're converting int to string there's allocations ther

Re: Making pure functions get dirty (D 2.0)

2009-02-20 Thread Burton Radons
Burton Radons Wrote: > void convertInto (T, U, alias write) (const (T) value) This should read "pure void". Everything I said about its behaviour is correct for my experiences.

Re: Batch files for running multiple DMD versions?

2009-02-17 Thread Burton Radons
Pha I just realised I was massively overengineering the whole damned thing. I don't need to install stuff, I just needed to push the different versions of DMD into their own separate paths with a common structure for the aliases. Duh!

Batch files for running multiple DMD versions?

2009-02-17 Thread Burton Radons
Does anyone have a batch file setup for running multiple DMD versions, that works with 2.025's refit? Specifically I want DMD 1.0, DMD 2.0, Tango, and Other, that can be run to install new versions when they're released and allow me to run "dmd-2.0" or "bud-tango" and it'll just work. I'm like 7

Retrieving storage from type tuples (D 2.0)

2009-02-17 Thread Burton Radons
Now I'm trying to go in the other way - detecting when a parameter to a function is ref. I know the compiler has this information in the tuple because of stringof: writef ("%s\n", ParameterTypeTuple! (void function (ref int))); // prints "(ref int)" But that information seems completely lost on

Re: Applying storage to type tuples

2009-02-09 Thread Burton Radons
Daniel Keep Wrote: > > > Burton Radons wrote: > > I'm writing a couple of modules for dealing with database values (well > > really it's just storage of aggregates) in a native fashion from within D, > > using D 2.023. I have a tuple called FieldTypes whic

Re: Can i safely cast void* from void[]?

2009-02-08 Thread Burton Radons
Heinz Wrote: > I remember i read around the D site that dinamic arrays can be stored in > system memory in a 'non contiguous' way (different locations). I was trying > to find again that page but haven't had any lucky. I'm not crazy, i know i > saw it. It could have meant that arrays might be

Applying storage to type tuples

2009-02-08 Thread Burton Radons
I'm writing a couple of modules for dealing with database values (well really it's just storage of aggregates) in a native fashion from within D, using D 2.023. I have a tuple called FieldTypes which contains the D-side types. I'm trying to use it to implement opApply: int opApply (int dele