|
Boost : |
Subject: Re: [boost] Boost.Local Review (Nov 10, 2011 to Nov 19, 2011)
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-11-15 04:08:05
On Mon, Nov 14, 2011 at 9:01 PM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> On 11/14/2011 04:59 PM, Lorenzo Caminiti wrote:
>>
>> In this email thread:
>> http://lists.boost.org/Archives/boost/2011/04/179834.php
>>
>> Three things where pointed out:
>> 1) _ prefix is for placeholders.
>> 2) _ postfix is for keywords.
>> 3) Boost.Phoenix already uses _this (as a placeholder).
>>
>> In the Boost.Local case _this/this_ is both:
>> 1) A placeholders because it will be "replaced" with the actual object
>> pointer `this`.
>> 2) And obviously a keyword.
>> So what do I do? _this or this_?
>>
>
> It should be this_. The way you're using it
> is not what I would consider a placeholder.
> If that were the definition of a placeholder
> than every reference should be considered a
> placeholder because the reference gets
> "replaced" with the actual object, which
> is absurd.
OK, I'm easily convinced one way or the other. Just to clarify this is
how it will look like:
// (a) using the keyword convention this_
int BOOST_LOCAL_FUNCTION_PARAMS(int x, const bind this_) {
return x + this_->value;
} BOOST_LOCAL_FUNCTION_NAME(l)
int y = l(123);
or
// (b) using the placeholder convention _this
int BOOST_LOCAL_FUNCTION_PARAMS(int x, const bind _this) {
return x + _this->value;
} BOOST_LOCAL_FUNCTION_NAME(l)
int y = l(123);
It sounds like most people think (a) is best so far because this_
plays the keyword (not placeholder) role in this context.
>> I might as well be consistent with another Boost library. Plus, if
>> _this is also used in the function declaration (not just the
>> definition) then it really acts as a placeholder. I am only 52% in
>> favor of _this over this_ and I am happy to use the name that the
>> reviewers find more correct.
>>
>> BTW, I couldn't find Phoenix docs that refer to _this-- does anyone
>> have a link? Is there any other Boost library that uses either _this
>> or this_?
I still would like to look at _this/this_ in other Boot libraries.
Does anyone have any link to docs, examples, etc for that?
Thanks.
--Lorenzo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk