[C++-sig] Boost.Python v2: beginning of generalized object support

David Abrahams david.abrahams at rcn.com
Fri Jul 19 15:14:55 CEST 2002


Hi,

Now that I'm revisiting this issue for my June monthly report, I'm not sure
that using the name for an inline member function "_" with one argument
would actually cause any problems in real code. AFAICT, the result would be
that the member function would be silently renamed "gettext" in the common
case... and all uses of the function will also be silently renamed to call
x.gettext(...). Yes, technically this gives an ODR violation if the file is
included with and without the macro defined, but I know of no real
compilers which will care about that.

Am I missing something here?

-Dave

----- Original Message -----
From: "Niki Spahiev" <niki at vintech.bg>
To: <c++-sig at python.org>
Sent: Monday, June 17, 2002 6:07 AM
Subject: Re: [C++-sig] Boost.Python v2: beginning of generalized object
support


> David Abrahams wrote:
> > From: "Niki Spahiev" <niki at vintech.bg>
> >
> >
> >>David Abrahams wrote:
> >>
> >>>object attribute access is available through the "_" member function:
> >>>
> >>>C++                    Python
> >>>
> >>>x._("foo") = 1;        x.foo = 1
> >>>y = x._("foo");        y = x.foo
> >>
> >>This will go into GNU gettext translation dictionary.
> >
> >
> > What is that?
>
> http://www.gnu.org/software/gettext/gettext.html
>
> >>_("...") is  default marker for gettext. Can boost.python use something
> >
> > other?
> >
> > I'm not sure. What problems could this cause?
>
> All attribute names will go to translatable strings (for UI).
>
> Why not:
>
> x.a("foo") = 1
> y = x.a("foo")
>
> or any other letter?
>
> regards,
> Niki Spahiev
>
>
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig






More information about the Cplusplus-sig mailing list