Re: [Boost-docs] [Gaea] Named optional attributes

Subject: Re: [Boost-docs] [Gaea] Named optional attributes
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-11-06 08:15:33


on Sat Nov 05 2011, Joel de Guzman <joel-AT-boost-consulting.com> wrote:

> On 11/6/2011 9:08 AM, Joel de Guzman wrote:
>> On 11/6/2011 5:58 AM, Matias Capeletto wrote:
>
> If we go this route (still unsure), perhaps we can make it clear
> by having a naming protocol that makes templates with side-effects
> clear. E.g. we can have in-place versions for:
>
> [decl [append! x e]]
> [decl [insert! x e n]]
> [decl [reverse! x]]
> [decl [join! x y]]
>
> Even:
>
> [decl [transform! x f]]
>
> This will open up a whole slew of templates like:
>
> [decl [for-each! x f]]
>
> Perhaps we should then rename [set x v] --> [set! x v]
>
> Is this good or bad? I don't know. Well, scheme and lisp do
> have side-effects. But, I kinda agree with Terrence Parr:
> "The fact that StringTemplate does not allow such things
> as assignments (no side-effects) should make you suspicious
> of engines that do allow it."

IMO if you can afford it, it's better to go side-effect-free.
If you can't afford it, I suggest labeling the name on which the
side-effect occurs, rather than labeling the function.

   [decl [append 'x e]]
   [decl [insert 'x e n]]
   [decl [reverse 'x]]
   [decl [join 'x y]]
   [decl [transform 'x f]]
   [decl [for-each 'x 'f]]

You might want to ask the caller to label the arguments that way, too...

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

This archive was generated by hypermail 2.1.7 : 2017-11-11 08:50:41 UTC