dcollections 1.0 and 2.0a beta released
Steven Schveighoffer
schveiguy at yahoo.com
Mon May 24 05:24:18 PDT 2010
On Sat, 22 May 2010 07:56:31 -0400, Michel Fortin
<michel.fortin at michelf.com> wrote:
> On 2010-05-21 22:55:16 -0400, Walter Bright <newshound1 at digitalmars.com>
> said:
>
>> Walter Bright wrote:
>>> If we can get anywhere close to that level of success with ranges and
>>> containers, we should all be well pleased.
>> Mike Taylor has a phrase for that I think is well-coined: "impedance
>> matching",
>> defined as the work necessary to get one library module to work with
>> another
>> library module.
>
> This makes me think about something.
>
> In principle, I like the idea of containers being reference type. It
> works well when passing a container to functions. But at the same time,
> I despite it. By-reference containers forces you to have extra
> indirections even when you don't need them, and you have to worry about
> null. Sometime a value-type would be better, when creating more complex
> data structures for instance:
>
> class Channel {
> private {
> Array!Message inbound;
> Array!Message outbound;
> }
>
> ...
> }
>
> What's the point of having extra indirection here?
Scope class members should solve this. It's been thrown around forever --
essentially, you should be able to define that a class member's storage is
contained within the owner object.
a value-type node-based containers just don't work well -- it's too easy
to escape references, and too easy to accidentally duplicate the entire
node set when passing to functions. It works fine for arrays because the
array has a very simple structure -- data and length. And the length and
data are somewhat orthogonal.
-Steve
More information about the Digitalmars-d-announce
mailing list