Re: New compose and format API
- From: Murray Cumming <murrayc murrayc com>
- To: Daniel Elstner <daniel kitta googlemail com>
- Cc: gtkmm-list gnome org
- Subject: Re: New compose and format API
- Date: Wed, 15 Aug 2007 11:15:04 +0200
On Wed, 2007-08-15 at 03:59 +0200, Daniel Elstner wrote:
> Am Dienstag, den 14.08.2007, 13:28 -0500 schrieb Jonathon Jongsma:
>
> > I already gave my opinion to Daniel on IRC, but I thought I'd post
> > here as well in case others want to weigh in. My preference is
> > currently for option 3. I think the desire to make the interface
> > similar to boost is laudable, but I personally find the 'function
> > argument' syntax much more readable than the operator% overloading.
> > But I do agree that for the common case of passing a plain string or
> > number (i.e. without any manipulators), it would be nice to drop the
> > extra ustring::format() call.
>
> Done. The API now looks like this:
>
> s = ustring::compose("%1 is lower than %2.",
> 12, ustring::format(std::hex, 16));
>
> I opted to keep the method names compose() and format() rather than
> switching to the boost names format() and group(). Since format() can
> be used without compose() it would be strange to call it group():
>
> s = ustring::format(12.3);
>
> Is that OK with you all?
It looks very usable.
I still want to wait for some more opinions from boost people, to avoid
unnecessary duplication/difference. But if they don't have something new
by the time we API freeze for glib 2.15/2.16 then I'll be happy to
freeze this API so we have something we can use.
Thanks, Daniel.
--
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]