Subject: Re: [boost] Boost.Local Review (Nov 10, 2011 to Nov 19, 2011)
From: Lorenzo Caminiti (lorcaminiti_at_[hidden])
Date: 2011-11-14 19:59:43
On Mon, Nov 14, 2011 at 7:25 PM, Jeffrey Lee Hellrung, Jr.
> On Mon, Nov 14, 2011 at 4:00 PM, Lorenzo Caminiti <lorcaminiti_at_[hidden]>wrote:
>> As it was suggested, I'm thinking that I will change from this_ to
>> _this (to be consistent with Phoenix) and require to use _this in both
>> the local function declaration and implementation (and error at
>> compile-time if you use this instead of _this in the declaration but I
>> still can't error if you mistakenly use this instead of _this in the
>> definition :( ). I will also leave the config macro so the users can
>> change this name if they want/need to.
> I think it would be more consistent with other Boost libraries to use
> "this_" rather than "_this".
> A leading underscore is used to distinguish domain-defined keywords and
> placeholders. This *kind of* fits that, but...well, to me, not exactly.
> On the other hand, one would almost certainly prefer to just use "this",
> except...you can't. Anytime you want to use a C++ keyword as an identifier
Yes, I can't :( This is marked in the Tutorial as Warning. The only
way I could figure out it's illegal because it relies on an undefined
behavior of static_cast (see Tutorial section footnote #13):
> but can't actually use the keyword verbatim, the consistent practice has
> been to append an underscore.
> Just my opinion, and it's not a big deal either way,
In this email thread:
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
2) And obviously a keyword.
So what do I do? _this or this_?
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk