Re: RFC: attaching functions to types

2015-03-23 Thread Shawn Landden
On Mon, Mar 23, 2015 at 11:39 AM, Andrew Pinski wrote: > On Mon, Mar 23, 2015 at 11:32 AM, Shawn Landden > wrote: >> On Fri, Mar 20, 2015 at 6:36 PM, Andrew Pinski wrote: >>> On Fri, Mar 20, 2015 at 6:05 PM, Shawn Landden >>> wrote: direct-declarator: ( type-qualifier[opt] t

Re: RFC: attaching functions to types

2015-03-23 Thread Andrew Pinski
On Mon, Mar 23, 2015 at 11:32 AM, Shawn Landden wrote: > On Fri, Mar 20, 2015 at 6:36 PM, Andrew Pinski wrote: >> On Fri, Mar 20, 2015 at 6:05 PM, Shawn Landden >> wrote: >>>direct-declarator: >>> ( type-qualifier[opt] type-specifier *[opt] identifier[opt] ) . >>> function-definition >

Re: RFC: attaching functions to types

2015-03-23 Thread Shawn Landden
On Fri, Mar 20, 2015 at 6:36 PM, Andrew Pinski wrote: > On Fri, Mar 20, 2015 at 6:05 PM, Shawn Landden wrote: >>direct-declarator: >> ( type-qualifier[opt] type-specifier *[opt] identifier[opt] ) . >> function-definition >> >> >> call like so: >> >> >> type.foo(baz); >> typep->foo(baz);

Re: RFC: attaching functions to types

2015-03-20 Thread Andrew Pinski
On Fri, Mar 20, 2015 at 6:05 PM, Shawn Landden wrote: >direct-declarator: > ( type-qualifier[opt] type-specifier *[opt] identifier[opt] ) . > function-definition > > > call like so: > > > type.foo(baz); > typep->foo(baz); Wait you are re-inventing C with classes and C++. Thanks, Andrew

RFC: attaching functions to types

2015-03-20 Thread Shawn Landden
direct-declarator: ( type-qualifier[opt] type-specifier *[opt] identifier[opt] ) . function-definition call like so: type.foo(baz); typep->foo(baz); type automatically becomes first parameter, (when used as a function pointer) and as a pointer to if that was included in definition. if