Re: syntax suggestion

Alexander Nasonov <[email protected]>
Newsgroups gmane.comp.lib.boost.langbinding
Message-ID <[email protected]>
Daniel Wallin wrote:

> Alexander Nasonov wrote:
>> I'd like to see inheritance more natural in langbinding. What do you
>> think if inheritance relationships could be exposed like this:
>> 
>> class_<C>("C")
>>     , public_<A>
>>     , public_<B>
>> [
>>     // ...
>> ];
> 
> The [] syntax still won't work (IMO) for declaring classes. So you'd end
> up with something like:
> 
>      class_<C>("C")
>          .public_<A>()
>          .public_<B>()
>        .def(..)
>        .def(..)
>        ;

I think it's possible to implement []-style but I'm not sure how much time
it would take to compile.

> Although it looks kind of cool, 'public_' is completely redundant since
> we are only interested in accessible bases anyway.
Not sure about this. We may need access to protected C++ bases from non-C++
class (I don't know how to implement it elegantly, though).

> 
> When in doubt I tend to go for the less verbose and less complicated
> alternative, so I guess I like the original version is better:
> 
>      class_<C, bases<A, B> >("C")
>        .def(..)
>        .def(..)
>        ;
> 
> Here are some other possibilities:
> 
>      // Cool, but not very portable
>      class_<C(A, B)>("C")
>        .def(..)
>        .def(..)
>        ;
> 
>      // Just add more parameters to class_<>, complicates
>      // the metaprogramming
>      class_<C, A, B)>("C")
>        .def(..)
>        .def(..)
>        ;
> 
> I'm not sure if either one has any significant benefits from the
> original though.
> 
> I think we need more opinions, anyone?
> 

-- 
Alexander Nasonov
Independent Developer and Consultant




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.