Re: syntax suggestion
David Abrahams <[email protected]>
| Newsgroups | gmane.comp.lib.boost.langbinding |
|---|---|
| Message-ID | <[email protected]> |
Daniel Wallin <[email protected]> writes: > David Abrahams wrote: > >> Alexander Nasonov <[email protected]> writes: >> >>>Daniel Wallin wrote: >>>>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") >> I like the syntax; I guess we need to decide whether we care about >> older compilers or not. > > Yeah, it mirrors both the python and luabind syntax. But I really > dislike dropping older compilers. I'm beginning to like the idea of dropping them. > Maybe supporting both ala Boost.Function? There's always: class_<C (*)(A,B)>("C") for the others, if we can afford not to have C deduced at the outer level w/o partial specialization. >>>> .def(..) >>>> .def(..) >>>> ; >>>> >>>> // Just add more parameters to class_<>, complicates >>>> // the metaprogramming >> Definitely problematic, especially if you want to be able to pass >> other parameters. > > Why? It's not like it's hard to discriminate the params. We do that in > both luabind and BPL already. True; for bases a little visual grouping is probably beneficial. Not a huge deal, though. On second thought, MI is rare enough that maybe it's not so important. >>>> >>>>I think we need more opinions, anyone? >> The only advantage I can see to using the []s is that it becomes a >> bit cleaner to define nested classes. > > FWIW, this is what it this currently looks like in luabind: > > module(L) > [ > class_<X>("X") > .static_ > [ > class_<Y>("Y") > ... > ] > ]; Nit: what is .static_ supposed to mean? Maybe .scope[ ... ] would be better? -- Dave Abrahams Boost Consulting www.boost-consulting.com ------------------------------------------------------- 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