Boost logo

Boost :

Subject: Re: [boost] Unicode: what kind of binary compatibility do we want?
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-06-02 11:18:53


Mathias Gaunard wrote
On Monday, June 01, 2009 11:09 PM
>
> As I am finishing putting property look-up together for the Unicode
> library GSoC, I am wondering what kind of binary compatibility it
> should aim for.
[snip]
> Basically, the current property design I have is like this
>
> struct some_property
> {
> enum type
> {
> some_default,
> some_value1,
> some_value2,
> ...
> _count;
> }
> };
>
> some_property::type get_some_property(char32 ch);
>
> With get_some_property a simple look-up in the table, but the table
> layout being version dependent it would need to be in the library TUs.
>
> However, a new version of the library may return a value that is not
> within the enum.
>
> Should it then work like this?
>
> some_property::type get_some_property(char32 ch)
> {
> some_property::type p = get_some_property_impl(ch);
> if(p >= some_property::_count)
> return some_property::some_default;
> return p;
> }

I don't know the implications of this, but I generally dislike the idea of a silent fallback. I'd prefer to see two interfaces: one throws an exception on out of range values and one that accepts a default value to return in those cases.

It might be useful to determine compatibility when the library starts, perhaps via an initialization call, and use the Strategy Pattern to determine the implementation. (When compatible, a property's accesses are unchecked. When incompatible, the property's accesses are checked.)

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk