Re: syntax suggestion

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

> Alexander Nasonov <[email protected]> writes:
> 
>> 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:
> 
> Not to mention that the []s will bind more closely to public_<B> than
> to the class_ object. 
Oops

> If we end up building an AST for the
> class declaration and then walking over it to evaluate it, I fear
> we're going to end up overstressing many compilers.
> 
>>>      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.
> 
> Agreed, it's possible. The compilation time is IMO a serious concern.

I agree, it's really serious.

>>> 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).
> 
> Actually I think the issue here is that we don't need to represent
> access.  Why would the system care whether a base was private or
> protected or public?

The system could make a decision if its overload resolution algorithm ended
up with a base member function. Members of protected base can be accessed
only from member functions of derived class.

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