[ 
https://issues.apache.org/jira/browse/THRIFT-5587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17547938#comment-17547938
 ] 

Jens Geyer commented on THRIFT-5587:
------------------------------------

{quote}for internal representation of the data, it's always {quote} whatever 
the optimal choice is per language. For C# there is System.Guid
{quote}For binary/compact protocols, it's encoded the same as len-16 byte 
array{quote}Thats the idea
{quote}For json reads, do we want to support other string formats defined in 
the RFC?{quote} Of course not because this is Thrift JSON. It looks the way we 
want it to be. Period. The canonical format just looks fine to me. JSON was 
never about saving bytes, so canonical seems indeed appropriate.
{quote}uuid{quote}I heard you. All of you.
{quote}Is this going to be essentially a typedef of 16-byte binary, or a 
typedef of string?{quote}That's a really good question. My first idea was "why 
not make it just another subtype of binary, like string technically is?".

But by setting bets on such a questionable compatibility gain, we would at the 
same time lose any option to store it differently, e.g. for JSON and binary 
formats, because we would then be *forced *to store it, well,  in a compatible 
manner (i.e. always either bytes OR string, regardless of the protocol). 

So in my opinion we really should make it a distinct type of its own.





> Introduce guid as additional builtin type
> -----------------------------------------
>
>                 Key: THRIFT-5587
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5587
>             Project: Thrift
>          Issue Type: New Feature
>          Components: Compiler (General)
>            Reporter: Jens Geyer
>            Assignee: Jens Geyer
>            Priority: Major
>
> I hereby propose to add *{{guid}}* as an additional built-in basic type.
> *Rationale:*
>  * Guids (or uuids) are a state of the art and well-understood way to 
> identitify data entities.
>  * There is support in next to all languages' runtimes to generate, convert 
> and store such data.
>  * Although conversion to and from string or binary is certainly possible, it 
> is also rather cumbersome.
>  * A distinct datatype enables us to sent it in the most suitable way across 
> the wire: JSON=text, Compact=binary
> *Remarks*
>  * I am open to discuss the term "guid" vs "uuid". Coming from NET platforms 
> I would tend to guid, but I am open to uuid (or even both) as well. That's 
> just a detail.
>  * If no significant concern is raised, I would move on and implement C#, 
> Delphi and Haxe bindings (as sub-tasks) myself and leave the rest to the 
> community.
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to