ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> C++-sig
C++-sig
[C++-sig] Re: (return_self_policy / return_arg): Keywors
by David Abrahams other posts by this author
Jul 3 2003 10:11PM messages near this date
[C++-sig] Re: (return_self_policy / return_arg): Keywors | [C++-sig] Re: Refactoring, Compilation Speed, Pyste, Lua/Ruby/JavaScript...
[Nikolay, please leave a blank line between quotations for
readability.  Thanks!]

Nikolay Mladenov <nickm@[...].com>  writes:

>  I've attached test files.
> 
> > OK, I don't understand this.  Isn't the 2nd constructor redundant?
> 
>  Yes it is but, having it makes certain calls more efficient (it's
>  cheating, in a way ), see the commented section in the py-file, may
>  be def with args can be made so it is really redundant.

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).

> > 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? 

> > 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?

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?

> > I suggest you write the documentation which would explain all this,
> 
>  Sure, but I think I'll wait a bit to see all of your comments:)

OK.

> > but posting informally is fine if you try to ensure that I don't have
> > to ask you lots more questions in order to understand it ;-)
> 
>  I hope this all makes sense to you.

It does.

In the examples, I'd prefer to see

                      arg("a") = int()
                    , arg("b") = double()
                    , arg("n") = std::string()

or 

                      arg("a") = 0
                    , arg("b") = 0.0
                    , arg("n") = std::string()

or 

                      arg("a") = 0
                    , arg("b") = 0.0
                    , arg("n") = ""

instead of 

                      arg("a") = (int)0
                    , arg("b") = (double)0
                    , arg("n") = std::string()

Aside from that and my previous comments, it looks scrumptious!

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig
Thread:
Nikolay Mladenov
David Abrahams
David Abrahams
Joel de Guzman
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
Nikolay Mladenov
David Abrahams
David Abrahams
Nikolay Mladenov
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams
Nikolay Mladenov
David Abrahams

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved