Re: D Beginner Trying Manual Memory Management

2015-01-14 Thread Laeeth Isharc via Digitalmars-d-learn
I don't think you've read h5py source in enough detail :) You're right - I haven't done more than browsed it. It's based HEAVILY on duck typing. There is a question here about what to do in D. On the one hand, the flexibility of being able to open a foreign HDF5 file where you don't know

Re: idiomatic D: what to use instead of pointers in constructing a tree data structure?

2015-01-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Tuesday, 13 January 2015 at 17:41:53 UTC, Tobias Pankrath wrote: On Tuesday, 13 January 2015 at 17:19:42 UTC, Laeeth Isharc wrote: The GC is allowed to move structs around, as I undestand it. Under what circumstances do I get into trouble having a pointer to them? None, a GC that moves

Re: redirecting the unittests error output

2015-01-14 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 14 January 2015 at 18:50:04 UTC, ref2401 wrote: How can i redirect the unittests error output to a file? You redirect stderr to a file using whatever tools your shell provides you. In anything related to unix sh you would do something like this: ./run_unittests 2errorFile

Re: idiomatic D: what to use instead of pointers in constructing a tree data structure?

2015-01-14 Thread via Digitalmars-d-learn
(( It follows from this that it will be challenging to achieve full memory safety without fixing the type system first. ))

Re: idiomatic D: what to use instead of pointers in constructing a tree data structure?

2015-01-14 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 14, 2015 at 07:05:16PM +, Laeeth Isharc via Digitalmars-d-learn wrote: On Tuesday, 13 January 2015 at 17:41:53 UTC, Tobias Pankrath wrote: On Tuesday, 13 January 2015 at 17:19:42 UTC, Laeeth Isharc wrote: The GC is allowed to move structs around, as I undestand it. Under

Re: idiomatic D: what to use instead of pointers in constructing a tree data structure?

2015-01-14 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Jan 14, 2015 at 07:43:17PM +, via Digitalmars-d-learn wrote: On Wednesday, 14 January 2015 at 19:36:44 UTC, H. S. Teoh via Digitalmars-d-learn wrote: Moral of the story: don't have struct fields that point to the struct itself. This is almost always a bad idea. Structs have value

redirecting the unittests error output

2015-01-14 Thread ref2401 via Digitalmars-d-learn
How can i redirect the unittests error output to a file?

Re: idiomatic D: what to use instead of pointers in constructing a tree data structure?

2015-01-14 Thread via Digitalmars-d-learn
On Wednesday, 14 January 2015 at 19:36:44 UTC, H. S. Teoh via Digitalmars-d-learn wrote: Moral of the story: don't have struct fields that point to the struct itself. This is almost always a bad idea. Structs have value semantics, and the implicit copying around will almost certainly break any

Re: idiomatic D: what to use instead of pointers in constructing a tree data structure?

2015-01-14 Thread via Digitalmars-d-learn
On Wednesday, 14 January 2015 at 20:23:26 UTC, H. S. Teoh via Digitalmars-d-learn wrote: Huh? ints have value semantics, yet you can take the address of a local int variable. What's your point? Strictly speaking the int looses its value semantics if you take the address of it, hold it and

Re: redirecting the unittests error output

2015-01-14 Thread ref2401 via Digitalmars-d-learn
Unfortunately i'm new to using shells. I use standard windows cmd. Here is my script: dmd main.d -debug -unittest -wi if %errorLevel% equ 0 ( start main.exe ) else ( echo --- Building failed! --- pause ) I wrote start main.exe 2 errorFile but it doesn't work.

Re: casting SysTime to ubyte[]

2015-01-14 Thread Laeeth Isharc via Digitalmars-d-learn
I really wouldn't advise doing that. SysTime contains a long which represents the time in hnsecs since midnight, January 1st, 1 A.D., and that could be written to a file quite easily. But it also contains a reference to a TimeZone object, so what you're doing would just be writing its

Re: vibe.d Subdirectory?

2015-01-14 Thread Laeeth Isharc via Digitalmars-d-learn
Actually I want to serve some JSON packed weather data (heck I also wrote my Global Climate Model partially in D and in C) - so I guess, I can use vibe.d to build a cgi. Cool. Do you incorporate the influence of solar activity via galactic rays / cloud formation and via volcanic activity?

Re: D Beginner Trying Manual Memory Management

2015-01-14 Thread Laeeth Isharc via Digitalmars-d-learn
In the hierarchy example above (c++ hdf hierarchy link), by using UFCS to implement the shared methods (which are achieved by multiple inheritance in the c++ counterpart) did you mean something like this? // id.d struct ID { int id; ... } // location.d struct Location { ID _id; alias _id

Re: D Beginner Trying Manual Memory Management

2015-01-14 Thread Laeeth Isharc via Digitalmars-d-learn
struct File { Location _location; alias _location this; ... } // group.d public import commonfg; struct File { Location _location; alias _location this; ... } // commonfg.d { ... } enum isContainer(T) = is(T: File) || is(T : Group); auto method1(T)(T obj, args) if (isContainer!T) { ... } auto

Re: D Beginner Trying Manual Memory Management

2015-01-14 Thread aldanor via Digitalmars-d-learn
On Wednesday, 14 January 2015 at 14:54:09 UTC, Laeeth Isharc wrote: In the hierarchy example above (c++ hdf hierarchy link), by using UFCS to implement the shared methods (which are achieved by multiple inheritance in the c++ counterpart) did you mean something like this? // id.d struct

Re: vibe.d Subdirectory?

2015-01-14 Thread Laeeth Isharc via Digitalmars-d-learn
On Wednesday, 14 January 2015 at 11:40:26 UTC, seany wrote: I am new to vibe.d and plying a bit with it. I notice, that in case of Apache, there is a root directory, often by default under /var/www or /srv/http (resp. ftp) if you are using linux, and then every time the client sends a

Re: D Beginner Trying Manual Memory Management

2015-01-14 Thread aldanor via Digitalmars-d-learn
On Wednesday, 14 January 2015 at 16:27:17 UTC, Laeeth Isharc wrote: struct File { Location _location; alias _location this; ... } // group.d public import commonfg; struct File { Location _location; alias _location this; ... } // commonfg.d { ... } enum isContainer(T) = is(T: File) || is(T :

Re: vibe.d Subdirectory?

2015-01-14 Thread ketmar via Digitalmars-d-learn
On Wed, 14 Jan 2015 12:37:33 + seany via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Wednesday, 14 January 2015 at 12:25:12 UTC, ketmar via Digitalmars-d-learn wrote: just forgot about that crappy scripting stuff and write your code in D! Actually I want to serve

vibe.d Subdirectory?

2015-01-14 Thread seany via Digitalmars-d-learn
I am new to vibe.d and plying a bit with it. I notice, that in case of Apache, there is a root directory, often by default under /var/www or /srv/http (resp. ftp) if you are using linux, and then every time the client sends a request, apache looks in to the root directory, deduces the

Re: vibe.d Subdirectory?

2015-01-14 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/01/2015 12:40 a.m., seany wrote: I am new to vibe.d and plying a bit with it. I notice, that in case of Apache, there is a root directory, often by default under /var/www or /srv/http (resp. ftp) if you are using linux, and then every time the client sends a request, apache looks in to

Re: Pointers and offsets

2015-01-14 Thread ketmar via Digitalmars-d-learn
On Wed, 14 Jan 2015 01:16:52 + Bauss via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Is it possible to access a pointer by its offsets. Ex. write a 32bit integer to a byte pointer at ex. offset 4. yes, it is. it's same as in c/c++, except that you have to add one magic

Re: How to avoid invalid memory operation errors (and more) in DLLs?

2015-01-14 Thread John Colvin via Digitalmars-d-learn
On Friday, 26 December 2014 at 00:40:45 UTC, Heinz wrote: Hello everyone, I'm making a big framework with D2 (DMD 2.066.1) and I've been encountering many errors related to threads in DLLs. My program flow is a main exe wich statically loads a main dll, then this main dll dynamically loads an

Re: reinterpret array

2015-01-14 Thread Dominikus Dittes Scherkl via Digitalmars-d-learn
On Tuesday, 13 January 2015 at 23:36:51 UTC, Artur Skawina via Digitalmars-d-learn wrote: It's neat, but the real problems with it are: 1) obfuscation - it hides those trivial bit ops behind layers of functions and operator overloads, which everyone reading the code must then figure out; Ok,

Re: vibe.d Subdirectory?

2015-01-14 Thread ketmar via Digitalmars-d-learn
On Wed, 14 Jan 2015 11:40:25 + seany via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I am new to vibe.d and plying a bit with it. I notice, that in case of Apache, there is a root directory, often by default under /var/www or /srv/http (resp. ftp) if you are using

Re: vibe.d Subdirectory?

2015-01-14 Thread seany via Digitalmars-d-learn
On Wednesday, 14 January 2015 at 12:25:12 UTC, ketmar via Digitalmars-d-learn wrote: just forgot about that crappy scripting stuff and write your code in D! Actually I want to serve some JSON packed weather data (heck I also wrote my Global Climate Model partially in D and in C) - so I