|
Boost : |
Subject: Re: [boost] [local] this_ or _this?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2011-04-05 20:01:28
AMDG
On 04/05/2011 04:52 PM, Lorenzo Caminiti wrote:
> On Sun, Apr 3, 2011 at 2:22 PM, Steven Watanabe<watanabesj_at_[hidden]> wrote:
>> On 04/03/2011 11:13 AM, Lorenzo Caminiti wrote:
>>>
>>> Boost.Local uses a special name `this_` to access the object `this`
>>> bound from the enclosing scope. Shall this name be `this_` or `_this`
>>> according to Boost practices?
>>>
>>> struct c {
>>> void g(int x) { ... }
>>> void f() {
>>> void BOOST_LOCAL_FUNCTION_PARAMS( (int x) (bind this) ) {
>>> this_->g(x); //<<<<<<<<< Shall this be `_this->g(x);`
>>> instead?
>>> ...
>>> } BOOST_LOCAL_FUNCTIO_NAME(l)
>>> ...
>>> }
>>> ...
>>> };
>>>
>>> In particular, some library uses _ postfix for statements like
>>> mpl::if_ (not mpl::_if) while other uses _ prefix for variables like
>>> phoenix::local_names::_f (not local_names::f_).
>>>
>>
>> The convention is that _xxx is used for placeholders.
>> xxx_ is used when xxx is a keyword.
>
> 1) What is the exact definition of a "placeholder"?
A placeholder is an object or type which
is intended to be replaced by another
object or type. Some Examples of placeholder
objects are _1, _2, etc, used in bind, lambda,
and phoenix. Examples of placeholder types
are mpl::_1, and boost::recursive_variant_.
I would not consider this_ a placeholder here.
> 2) What is the convention for an xxx that is both a keyword and a placeholder?
>
The situation hasn't come up.
In Christ,
Steven Watanabe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk