What would be the mapping for C or C++?  I think there is an advantage of 
keeping the set of data types very limited, to primitive values which can be 
easily mapped to multiple languages.

Otherwise things can get complicated. Let's take date as an example. It's 
representation depends on the calendar used. Gregorian is very common, but 
other systems are used as well (Japanese, Buddhist). Also, when your are saying 
Date are you implying to have just day accuracy or get to hour, minute, second, 
millisecond etc.. WIth all these a string representation can get quite long 
which is against protocol buffer's goal to keep the serialized size small. 

However, most likely in particular applications based on protocol buffers most 
likely you do not need all the flexibility and you can have some conventions: 
only gregorian calendar is used and we only need day accuracy. With these 
probably you can represent a date in a simple int32 as a value relative to an 
absolute date. Is more compact and much faster to process. If you are only 
using java then you can stick with the Java's convention of representing time 
as number of milliseconds since January 1'st, 1970 UTC and use a int64 for this 
- reduces the chance of making mistakes.

On Apr 4, 2012, at 11:21 AM, Jawaid Hakim wrote:

> Date and decimal types are ubiquitous and in wide use.  Language specific 
> bindings could easily be created - this is exactly what we do in some other 
> open source projects that I contribute to. The way I envision it, protocol 
> buffers would provide 'date' and 'decimal' types - protoc compiler would 
> compile these into language specific data types (e.g. java.util.Date for Java 
> and DateTime for C#).
> 
> Jawaid Hakim
> Chief Technology Officer
> CodeStreet LLC
> 646 442 2804
> www.codestreet.com
> 
> 
> 
> 
> -----Original Message-----
> From: Alexandru Turc [mailto:[email protected]] 
> Sent: Wednesday, April 04, 2012 5:09 PM
> To: Jawaid Hakim
> Cc: Protocol Buffers
> Subject: Re: [protobuf] Additional data types
> 
> 
> proto files are mapped to many languages, Date and BigDecimal are java 
> specific. 
> 
> On Apr 4, 2012, at 9:37 AM, jhakim wrote:
> 
>> Any plans to provide out-of-the-box for commonly used data types such
>> as Date (encoded as String) and BigDecimal/BigInteger types? Seems
>> this would be of interest to a lot of users.
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/protobuf?hl=en.
>> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to