[C++-sig] Re: (return_self_policy / return_arg): Keywors

Nikolay Mladenov nickm at sitius.com
Fri Jul 4 19:04:41 CEST 2003


David Abrahams wrote:
> OK, I would like to see "irrelevancies" removed from the code for any
> test case, though... unless you think the efficiency issue is closely
> related to the keyword support, in which case you'll have to convince
> me (please).

I am not sure what needs convincing? There is an efficiency issue. Don't
you agree?

I put those just so to answer you question on why I have redundant
constructor.
I don't mean to keep them


> 
> >> Why are you using no_init?
> >
> > For the same reason, not that it makes sence for my first example,
> > but in general, I want my most offsen called overload to be first in
> > the list - so defined last.
> 
> That still doesn't explain why you'd want to use no_init.  Why not
> just define the more-important constructor 2nd?


Are you saying that I should put the first constructor as parameter of
the class_ constructor?
Cause I really prefer the def way for exporting constructors.
I was not realizing the fact that class_() implicitly defines default
constructor for a long time,
and I think that this is somewhat confusing.




> 
> >> Doesn't this stuff work for regular functions and member functions,
> >> too?
> >
> > Yes it works, see the test.
> 
> Fantastic.
> 
> >> ...and shouldn't we get rid of the need to write the outer
> >> "args(...)"?
> > It is not necessary to have it, you can write
> >       (arg("a") = (int)0, arg("b") = (double)0, arg("n") = std::string()))
> > instead of
> >       args(arg("a") = (int)0, arg("b") = (double)0, arg("n") =
> > std::string()))
> > but you'll probably want
> >       args("a","b","c", arg("n") = std::string()))
> > instead of
> >       (arg("a"), arg("b"), arg("c"), arg("n") = std::string()))
> 
> Understood... but is it really wise to give people more than One (And
> Preferably Only One) Obvious Way To Do It?


Why not? They are not *too* different, are they?


> 
> I might be inclined to support only:
> 
>   args("a","b","c")
> 
> and:
> 
>   (arg("a"), arg("b"), arg("c"), arg("n") = std::string()))
> 
> Or even drop the 1st and go with
> 
>   (arg("a"), arg("b"), arg("c"))
> 
> Thoughts?


Well, originally I thought that args() is already in the library so it
should not be removed.
So if you insist on being minimal, than probably we should support

	args("a","b","c") // which is already there
 
	arg("d")=1 

and at the end:

	( args("a","b","c"), arg("d")=1, arg("e")=std::string() ) 
	( arg("a"), arg("d")=1, arg("e")=std::string() ) 



>





More information about the Cplusplus-sig mailing list