This certainly seems like a reasonable thing to add. I'm not sure if there is a 
reason we have omitted these. 

I'm guessing that most people are just using C++ for server endpoints, which 
mainly receive data structures and use the implicit field semantics whereby 
fields are always written in responses (I believe C++ only omits writing fields 
explicitly marked as optional in the IDL).

I expect a patch which adds formal setters would be met with little opposition. 
Definitely feel free to dive in and add this.

Cheers,
mcslee

-----Original Message-----
From: Fournier, Jean-Pierre (JP) [mailto:[email protected]] 
Sent: Sunday, November 21, 2010 3:06 PM
To: [email protected]
Subject: no c++ accessor methods?



Hi,

I just completed a little c++ based thrift 0.5.0 prototype and I was a bit 
surprised that there were no setter methods for fields.  

This is the kind of code i ended up writing:

myContact.firstname = string(parsedValue);             
myContact.__isset.firstname = true;

I'm curious why there are no accessor methods generated for c++. 

(I'm a c++ newbie so I wouldn't be surprised to hear that I am doing something 
stupid)


Any thoughts or pointers appreciated.

jp

Reply via email to