C++Now! 2012 slides

Dmitry Olshansky dmitry.olsh at gmail.com
Thu Jun 7 13:46:37 PDT 2012


On 07.06.2012 20:04, bearophile wrote:
> The slide packs of the conference C++Now! 2012 are available:
> https://github.com/boostcon/cppnow_presentations_2012
>

Thanks, nice stuff for my brain to chew on.

For one thing the ustring caught my eye. It goes in the right direction 
... for C++.

My first observations on the matter:

1) We all know COW strings are not good... because in C++ you have 
damned shared by default, folks!
That implies using atomic refcounting to be on the safe side, yet in D 
we have thread local by default, and ref-counting/COW is perfectly fine.
(for non-shared types).

2) Immutable strings have performance cost ... like tracking ownership 
and reference counting - unless you have GC by your side, in which case 
it's cheap and legal :)

3) Embeddable strings are not so hard to get in D, since there are 
char[...] arrays (that are even correctly value types!).

4) Small string optimization is kind of cool... for mutable strings 
mostly or as long as your GC sucks. (Small strings kind of prevent 
pooling, you know)

All that being said I could envision FlexString type in D, that does the 
following:
- easily integrates with string
- small string optimization (yay!)
- (maybe) allow any known encoding including legacy (and the list is 
extendable), convert on demand
- has plugable allocator (Andrei where was that nice design ? ;) )
- thus it could live on stack

Unlike c++ folks, we don't need:
- find and etc. to be members of string
- I personally against legacy encoding, let's stick with utf-8/utf-16
- customizable grow rates? (strange problem as I think preallocation is 
your beast friend where it may matter)

As far as small string goes I'd say a lot of containers would benefit of 
such packing, could be nice to generalize the concept.

The end of wish list:

Rope class would be cool, like... real cool. I guess std.container has 
to be package though :)


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list