[Rprotobuf-yada] c++ class names

francoisromain at free.fr francoisromain at free.fr
Sat Dec 5 19:04:36 CET 2009


Hi, 

I agree with you on the c++ code. What about keeping just one : google::prototuf. The code is really all about these classes. And append the compiler prrfix when necessary, like I do with the io namespace ? Or would you rather go "using" free ? 

For the S4 classes, it does not really matter. The thing is our s4 class is really just there to shadow a c++ class, and it would be nicer if both had the same name. 

I am cooking up a quick java http server so that I can do an R client for rpc over http, and then in a few weeks when simon commits the generic web server code (I really look forward to this) we can make the r rpc server over http. With this and abit of unit test, we'll have quite a decent package.

Romain

------Message d'origine------
De: Dirk Eddelbuettel
À: Romain François
Cc: rprotobuf-yada at lists.r-forge.r-project.org
Envoyé: 5 déc 2009 16:43
Objet: Re: [Rprotobuf-yada] c++ class names


On 5 December 2009 at 08:31, Romain François wrote:
| Hello,
| 
| I am getting annoyed by the "protobuf" prefix we have for the S4 classes 
| that shadow some C++ classes:
| 
| protobufDescriptor
| protobufFieldDescriptor
| protobufEnumDescriptor
| protobufServiceDescriptor
| protobufMethodDescriptor
| protobufFileDescriptor
| protobufMessage
| 
| and was thinking maybe we can remove the prefix before we release the 
| first version.

I'd rather go the other way -- something I meant to bring up was that 

    using namespace google::protobuf::compiler ;
    using namespace google::protobuf ;

is considered uncool as it is 'too global' and against the spirit of
namespaces.  OTOH it is really, really long -- but one can do tricks such as
namespace aliases:

    namespace gpc = google::protobuf::compiler;
    namespace gp  = google::protobuf;

which, instead of requiring (without the using namespace ...)

    google::protobuf::compiler::Foo f;

allows a much simpler

    gpc::Foo f;

Of course, we could also use GPC or GooPrCo or ...  

What do you think?  


As for your question above, I hear you. But I am too much of a noob with S4
to be really comfortable.  To me, this is safe and explicit. Dunno.

Dirk

-- 
Three out of two people have difficulties with fractions.



More information about the Rprotobuf-yada mailing list