Subject: [DGD] Why export data structures?
From: [email-masked] (Kris Van Hees)
Date: Thu Jun 23 00:51:01 2005

Older versions of DGD actually handled arrays and mappings as references to a
single instance of the structure, until the object got swapped out (which did
cause the object to getits own copy of the structure data).  Because swapping
of objects was unpredictable, that behaviour got changed to be more specific.
I remember long conversations with Dworkin about that logic, because I was in
fact implementing just that as part of my Master's Thesis.  The logic in  DGD
reflects the same concept, with Dworkin's own implementation (and as far as I
can see that implementation has of course also evolved over time  with  other
features being added to DGD).

	Cheers,
	Kris

On Wed, Jun 22, 2005 at 03:44:37PM -0700, Noah Gibbs wrote:
>   There are probably many fine reasons.  One reason is that the way DGD handles
> memory strongly suggests it.  DGD handles its memory in very explicit chunks -
> specifically, each DGD 'object' is managed as a single chunk.  Objects can
> point at each other, but pointing at sub-objects (like mappings, LWOs or
> arrays) inside other DGD objects would require the memory management to be
> messier.
> 
>   Currently DGD can have a single identifier for each DGD object, so you can
> potentially have four billion of them.  Being able to point to sub-objects
> would give you less 'name space' in that sense.  I guess you could point to
> sub-objects as offsets from the start of their actual object - but then, that's
> pretty much the equivalent of how you handle them now in LPC.
> 
>   Also, currently it's easy to tell when you might be pulling a bunch of new
> stuff into memory.  If you could reference other people's sub-objects without
> using DGD object pointers, you'd have a bunch of other cases where you could be
> pulling their stuff into memory.
> 
>   None of this actually demands that you not be able to touch other people's
> sub-objects, they're just reasons why it's basically a good idea not to.  I
> don't know of any reason why DGD couldn't be altered to do this, though I
> expect it'd be a lot of work.
> 
> --- Petter Nyström wrote:
> 
> > Hello!
> > 
> > This is really just a question out of curiousity. I was thinking of coding 
> > something that relied on several objects having access to the same data 
> > structure - in this case a mapping. But then I learned that such data 
> > structures are made into individual copies in all objects referencing it 
> > at the end of the execution thread. So as I understand it, the objects 
> > would no longer be referencing the same data in later threads.
> > 
> > Now, I have no reason to be upset why it works like this. I am merely 
> > being curious as to the reasons. Why does DGD do this? If someone's got 
> > the time to satiate my curiousity, I'd be happy!
> > 
> > Regards,
> > 
> > Jimorie