This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On 08/04/2009 09:35 AM, John Freeman wrote:
In my opinion, lambdas are not intended as just a shortcut to writing a function object class. This is why our proposal did not require that lambdas be implemented as classes; it is simply one implementation. (Awaiting word to see if this is still the case in the working draft of the standard; it may not be, but that doesn't change my opinion :)
From N2859: "The type of the lambda-expression (which is also the type of the closure object) is a unique, unnamed non-union class type—called the closure type...."
IMO, it's better to define new functionality in terms of already familiar features rather than have to specify everything about how a new feature interacts with the rest of the language.
In response to Jason's concern here, a template implementation is not required, just convenient. Hopefully you won't think of it as "templates without template syntax", but "deduction using the existing template mechanism".
As above, suggesting that it doesn't have to be a template suggests that there's a lot more specification left to do, such as how do you deal with expressions whose type you don't know yet? If you allow non-lambda uses, how do they fit into overload resolution? If you just say it's a template, we already know how they work.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |