
"Jeff Garland" <jeff@crystalclearsoftware.com> writes:
On Fri, 24 Jun 2005 09:19:05 -0400, David Abrahams wrote
You mean
ar & my_non_const_object
works? If so, I'm less worried. However, the non-uniformity seems a bit gratuitous, and I think you're setting a bad precedent by equating non-const with "will change," even if that interpretation is overridable.
I'm worried people will get in the 'habit' of casting to use serialization. And in the real world that won't be using fancy C++ casts -- they'll get out the big bad c-cast hammer. And IME once the casting starts it has a way of growing -- programmers see the casts and 'learn from them'.
Yeah, with all due respect to the author -- who has designed a library that's by all accounts very satisfying -- this design choice is just all wrong. It doesn't detect what it purports to, and gives plenty of false positives. Because it's a compile-time check people will get used to doing what is required to subvert it. It's well known that error reports that are commonly wrong are worse than no report at all. The hashing idea is a lot closer to the mark.
I'm starting to care.
The whole thing has been blown waaay out of proportion.
Maybe. These days, I am putting a lot more attention on small details of libraries that I hadn't seen much of before. It isn't personal; I am just trying to keep the overall quality high.
I never stopped caring, I just got tired. Since the moment this change went into the library and blew up date-time tests and some of my other programs that were working perfectly I was unhappy. But neither Vladimir or myself have been able to convince Robert that this change is ill advised
I've noticed a similar dynamic with a few other Boost libraries recently. It would be so much easier if everyone would just do it my way :^)
-- so I just stopped and modified my stuff. I ended up adding something to the date-time docs so that we can demonstrate stack-based serialization:
NOTE: due to a change in the serialization library interface, it is now required that all streamable objects be const prior to writing to the archive.
Actually that's not even accurate. Forming a const reference to an object doesn't make the object const. The fact that this design makes you write something hard to explain might be a clue that it isn't helping.
The following template function will allow for this (and is used in the date_time tests). At this time no special steps are necessary to read from an archive.
template<class archive_type, class temporal_type> void save_to(archive_type& ar, const temporal_type& tt) { ar << tt; }
Feels/looks like an ugly workaround to me...
Yah. Just another pointless hoop to jump through. -- Dave Abrahams Boost Consulting www.boost-consulting.com