std.container and classes

Caligo iteronvexor at gmail.com
Sat Dec 17 20:57:46 PST 2011


On Tue, Dec 13, 2011 at 9:08 PM, Jonathan M Davis <jmdavisProg at gmx.com>wrote:

> Is the plan for std.container still to have all of its containers be final
> classes (classes so that they're reference types and final so that their
> functions are inlinable)? Or has that changed? I believe that Andrei said
> something recently about discussing reference counting and containers with
> Walter.
>
> The reason that I bring this up is that Array and SList are still structs,
> and
> the longer that they're structs, the more code that will break when they
> get
> changed to classes. Granted, some level of code breakage may occur when we
> add
> custom allocators to them, but since that would probably only affect the
> constructor (and preferably wouldn't affect anything if you want to simply
> create a container with the GC heap as you would now were Array and SList
> classes), the breakage for that should be minimal.
>
> Is there any reason for me to not just go and make Array and SList final
> classes and create a pull request for it?
>
> - Jonathan M Davis
>

What happens in cases where you need to extend functionality of those
containers by inheritance?  With structs you'll have to rely on composition.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20111217/acf8fdf2/attachment.html>


More information about the Digitalmars-d mailing list