[Format] Making a change

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

[Format] Making a change

John M. Dlugosz
I'd like to make a change to the Boost Format library, to add a conversion operator to the
matching string class.
It appears to have not been worked on in a number of years.
Reading through the web site, I find details on how to submit new libraries, and how to
edit the web page, but nothing on submitting updates to existing libraries.

How would I go about doing that, for this library in particular?

—John


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Vicente Botet
John M. Dlugosz wrote
I'd like to make a change to the Boost Format library, to add a conversion operator to the
matching string class.
It appears to have not been worked on in a number of years.
Reading through the web site, I find details on how to submit new libraries, and how to
edit the web page, but nothing on submitting updates to existing libraries.

How would I go about doing that, for this library in particular?
Hi,

This http://www.boost.org/community/requests.html should help you.

* Discuss the issue on the dev list
* Create a ticket on the Trac System adding as much information as possible, patch containing the code modified, tests, doc, ...

Best,
Vicente

Best,
Vicente
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

John M. Dlugosz
On 2/13/2012 3:39 AM, Vicente Botet wrote:
>
> This http://www.boost.org/community/requests.html should help you.
>
> * Discuss the issue on the dev list
> * Create a ticket on the Trac System adding as much information as possible,
> patch containing the code modified, tests, doc, ...
>

Interestingly, that page states, "You can also try submitting a feature request to our
ticket system, but experience has shown that posting to either of the mailing lists is
usually a more effective way to get attention of boost developers."





_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Daryle Walker
In reply to this post by John M. Dlugosz

> Date: Mon, 13 Feb 2012 03:16:12 -0600
> From: [hidden email]
>
> I'd like to make a change to the Boost Format library, to add a conversion operator to the
> matching string class.
> It appears to have not been worked on in a number of years.
> Reading through the web site, I find details on how to submit new libraries, and how to
> edit the web page, but nothing on submitting updates to existing libraries.
>
> How would I go about doing that, for this library in particular?

Wasn't there recently another thread about this?  If you didn't read that thread, it referredto another thread from 7 years ago about the same thing.  Boost.Format already provides amember function and a free function to convert a format object to a string.  The conversionsthrow if the format object hasn't had all of its parameters filled in.  You want to add a thirdmethod?  Unlike int vs. double, a formatting object and a string are NOT conceptually the samething, so adding an implicit conversion would be bad.  (Actually, we should limit implicitconversions in general; so converting weakly-connected types should definitely be out.)
Daryle W.
     

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Olaf van der Spek-3
On Tue, Feb 14, 2012 at 6:04 AM, Daryle Walker <[hidden email]> wrote:
> Wasn't there recently another thread about this?  If you didn't read that thread, it referredto another thread from 7 years ago about the same thing.  Boost.Format already provides amember function and a free function to convert a format object to a string.  The conversionsthrow if the format object hasn't had all of its parameters filled in.  You want to add a thirdmethod?

Yes, please

> Unlike int vs. double, a formatting object and a string are NOT conceptually the samething, so adding an implicit conversion would be bad.  (Actually, we should limit implicitconversions in general; so converting weakly-connected types should definitely be out.)

Why would that be bad? The conversion from format to string is well
defined and used (very) frequently. It's also cumbersome at the
moment.

Compare:
1: set(dict2, "link", (boost::format("../../?q=%s") % name).str());
2: set(dict2, "link", boost::format("../../?q=%s") % name);

--
Olaf

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

John M. Dlugosz
In reply to this post by Daryle Walker
On 2/13/2012 11:04 PM, Daryle Walker wrote:
>
> Wasn't there recently another thread about this?  If you didn't read that thread, it referredto another thread from 7 years ago about the same thing.  Boost.Format already provides amember function and a free function to convert a format object to a string.  The conversionsthrow if the format object hasn't had all of its parameters filled in.  You want to add a thirdmethod?  Unlike int vs. double, a formatting object and a string are NOT conceptually the samething, so adding an implicit conversion would be bad.  (Actually, we should limit implicitconversions in general; so converting weakly-connected types should definitely be out.)
> Daryle W.
>    
>

Yes, I do indeed.  Both forms of str require extra parens and is a bit awkward for
in-place formatting of strings, in particular for error messages like the argument to an
exception constructor.

Would it go over well if we _removed_ the ability for ostream to take a formatter without
an extra function call?  After all, you could use str for that too!  My impression is that
the ostream use-case was thought about, but the exception case was not.
I do admit that for a named string variable, initializing it using free-function str isn't
too bad.

—John

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

John M. Dlugosz
In reply to this post by Olaf van der Spek-3
On 2/14/2012 6:18 AM, Olaf van der Spek wrote:
>
> Yes, please
>…
> Compare:
> 1: set(dict2, "link", (boost::format("../../?q=%s") % name).str());
> 2: set(dict2, "link", boost::format("../../?q=%s") % name);
>

I've submitted a changed file (one line added, plus comments) as Ticket #6553.
As far as I know, other threads have just complained about the lack and lamented it.  So
let's _do_ it already.  Is there a committee, an official owner of that component, or
what?  How do we get that change accepted in the official build?

—John

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Olaf van der Spek-3
In reply to this post by John M. Dlugosz
On Tue, Feb 14, 2012 at 1:56 PM, John M. Dlugosz <[hidden email]> wrote:
> Would it go over well if we _removed_ the ability for ostream to take a
> formatter without an extra function call?

Probably not. Why break old code?

> After all, you could use str for
> that too!  My impression is that the ostream use-case was thought about, but
> the exception case was not.
> I do admit that for a named string variable, initializing it using
> free-function str isn't too bad.

But it could be better.

> I've submitted a changed file (one line added, plus comments) as Ticket
> #6553.
> As far as I know, other threads have just complained about the lack and
> lamented it.  So let's _do_ it already.  Is there a committee, an official
> owner of that component, or what?  How do we get that change accepted in the
> official build?

That might a bit problematic. :p
Samuel Krempp is listed as the author of that lib.

--
Olaf

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Michel MORIN
In reply to this post by John M. Dlugosz
John M. Dlugosz wrote:
> I've submitted a changed file (one line added, plus comments) as Ticket
> #6553.

It would be better to submit patches rather than modified files.
To create a patch, you can use "svn diff".

Plus, adding updates to the documentation and tests
make your work more appealing.


Regards,
Michel

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Jeffrey Lee Hellrung, Jr.-2
In reply to this post by Olaf van der Spek-3
On Tue, Feb 14, 2012 at 4:18 AM, Olaf van der Spek <[hidden email]> wrote:
[...]

> > Unlike int vs. double, a formatting object and a string are NOT
> conceptually the samething, so adding an implicit conversion would be bad.
>  (Actually, we should limit implicitconversions in general; so converting
> weakly-connected types should definitely be out.)
>
> Why would that be bad? The conversion from format to string is well
> defined and used (very) frequently. It's also cumbersome at the
> moment.
>
> Compare:
> 1: set(dict2, "link", (boost::format("../../?q=%s") % name).str());
> 2: set(dict2, "link", boost::format("../../?q=%s") % name);


I don't see a problem with 1. It makes your conversion intentions clear,
and I don't find it onerous in the least.

(My opinion, of course.)

- Jeff

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Nathan Ridge

> From: [hidden email]
>
> On Tue, Feb 14, 2012 at 4:18 AM, Olaf van der Spek <[hidden email]> wrote:
> [...]
>
> > > Unlike int vs. double, a formatting object and a string are NOT
> > conceptually the samething, so adding an implicit conversion would be bad.
> > (Actually, we should limit implicitconversions in general; so converting
> > weakly-connected types should definitely be out.)
> >
> > Why would that be bad? The conversion from format to string is well
> > defined and used (very) frequently. It's also cumbersome at the
> > moment.
> >
> > Compare:
> > 1: set(dict2, "link", (boost::format("../../?q=%s") % name).str());
> > 2: set(dict2, "link", boost::format("../../?q=%s") % name);
>
>
> I don't see a problem with 1. It makes your conversion intentions clear,
> and I don't find it onerous in the least.
>
> (My opinion, of course.)
>
> - Jeff

Upon some reflection, neither of these look natural to me.

What would look natural is the following, implemented using C++11 variadic
templates (and then the return value could be a string in the first place):

set(dict2, "link", boost::format("../../?q=%s", name));

Regards,
Nate
     

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Olaf van der Spek-3
On Wed, Feb 15, 2012 at 4:27 AM, Nathan Ridge <[hidden email]> wrote:

>> > Compare:
>> > 1: set(dict2, "link", (boost::format("../../?q=%s") % name).str());
>> > 2: set(dict2, "link", boost::format("../../?q=%s") % name);
>>
>>
>> I don't see a problem with 1. It makes your conversion intentions clear,
>> and I don't find it onerous in the least.
>>
>> (My opinion, of course.)
>>
>> - Jeff
>
> Upon some reflection, neither of these look natural to me.
>
> What would look natural is the following, implemented using C++11 variadic
> templates (and then the return value could be a string in the first place):
>
> set(dict2, "link", boost::format("../../?q=%s", name));

Yes, that'd be even better, but variadic templates won't be an option
(for me) any time soon.
--
Olaf

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Vicente Botet
In reply to this post by Nathan Ridge
Nathan Ridge wrote
> From: [hidden email]
>
> On Tue, Feb 14, 2012 at 4:18 AM, Olaf van der Spek <[hidden email]> wrote:
> [...]
>
> > > Unlike int vs. double, a formatting object and a string are NOT
> > conceptually the samething, so adding an implicit conversion would be bad.
> > (Actually, we should limit implicitconversions in general; so converting
> > weakly-connected types should definitely be out.)
> >
> > Why would that be bad? The conversion from format to string is well
> > defined and used (very) frequently. It's also cumbersome at the
> > moment.
> >
> > Compare:
> > 1: set(dict2, "link", (boost::format("../../?q=%s") % name).str());
> > 2: set(dict2, "link", boost::format("../../?q=%s") % name);
>
>
> I don't see a problem with 1. It makes your conversion intentions clear,
> and I don't find it onerous in the least.
>
> (My opinion, of course.)
>
> - Jeff

Upon some reflection, neither of these look natural to me.

What would look natural is the following, implemented using C++11 variadic
templates (and then the return value could be a string in the first place):

set(dict2, "link", boost::format("../../?q=%s", name));
Note that Boost.Format works differently depending on the locale of the Output Stream. So, I guess your proposal is not an option.

IIRC, when you use explicitly the str function you are stating explicitly that you want to use the default locale.

I don't see yet why

set(dict2, "link", str(format("../../?q=%s") % name));

is not satisfactory.

Best,
Vicente
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Olaf van der Spek-3
On Wed, Feb 15, 2012 at 12:16 PM, Vicente Botet
<[hidden email]> wrote:

>> Upon some reflection, neither of these look natural to me.
>>
>> What would look natural is the following, implemented using C++11 variadic
>> templates (and then the return value could be a string in the first
>> place):
>>
>> set(dict2, "link", boost::format("../../?q=%s", name));
>>
>>
>
> Note that Boost.Format works differently depending on the locale of the
> Output Stream. So, I guess your proposal is not an option.

Argh, those silly locales again.

> IIRC, when you use explicitly the str function you are stating explicitly
> that you want to use the default locale.
>
> I don't see yet why
>
> set(dict2, "link", str(format("../../?q=%s") % name)); // 1
> set(dict2, "link", format("../../?q=%s") % name); // 2
>
> is not satisfactory.

It's still worse than 2.


--
Olaf

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Jeff Flinn-2
Olaf van der Spek wrote:

> On Wed, Feb 15, 2012 at 12:16 PM, Vicente Botet
> <[hidden email]> wrote:
>>> Upon some reflection, neither of these look natural to me.
>>>
>>> What would look natural is the following, implemented using C++11 variadic
>>> templates (and then the return value could be a string in the first
>>> place):
>>>
>>> set(dict2, "link", boost::format("../../?q=%s", name));
>>>
>>>
>> Note that Boost.Format works differently depending on the locale of the
>> Output Stream. So, I guess your proposal is not an option.
>
> Argh, those silly locales again.
>
>> IIRC, when you use explicitly the str function you are stating explicitly
>> that you want to use the default locale.
>>
>> I don't see yet why
>>
>> set(dict2, "link", str(format("../../?q=%s") % name)); // 1
>> set(dict2, "link", format("../../?q=%s") % name); // 2
>>
>> is not satisfactory.
>
> It's still worse than 2.

Which is worse than:

set(dict2, "link", "../../?q=" + name);

Facetiousness aside, how would wstrings be dealt with?

Jeff


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Reply | Threaded
Open this post in threaded view
|

Re: [Format] Making a change

Olaf van der Spek-3
On Wed, Feb 15, 2012 at 2:49 PM, Jeff Flinn <[hidden email]> wrote:

>> Argh, those silly locales again.
>>
>>> IIRC, when you use explicitly the str function you are stating explicitly
>>> that you want to use the default locale.
>>>
>>> I don't see yet why
>>>
>>> set(dict2, "link", str(format("../../?q=%s") % name)); // 1
>>> set(dict2, "link", format("../../?q=%s") % name); // 2
>>>
>>> is not satisfactory.
>>
>>
>> It's still worse than 2.
>
>
> Which is worse than:
>
> set(dict2, "link", "../../?q=" + name);

Yeah, hmm...

> Facetiousness aside, how would wstrings be dealt with?

Same as before?

--
Olaf

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost