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

Yuxuan Wang commented on THRIFT-5587:
-------------------------------------

Is this going to be essentially a typedef of 16-byte binary, or a typedef of 
string? If it's typedef of string, do we expect the string to contain dashes? 
(e.g. "123e4567-e89b-12d3-a456-426614174000" vs. 
"123e4567e89b12d3a456426614174000") I guess 16-byte binary is much easier as we 
do not need any additional validations to consider it a valid uuid, but the 
decision should be explicit in the proposal.

For language libraries/compilers, is it that if the language has uuid/guid in 
the stdlib, use that type, otherwise just use len-16 byte array (with potential 
special handlings of json or other protocols)? If we still need to handle 
string parsing then 3 is still a concern (but again, for go this is a minor 
concern, not really a deal breaker)

So I guess the details would be like:
 # For internal representation of the data, it's always len-16 byte array (or 
the uuid/guid type provided by the stdlib of the library language)
 # For binary/compact protocols, it's encoded the same as len-16 byte array
 # For json protocol, it's encoded to the canonical string format 
("123e4567-e89b-12d3-a456-426614174000", with dashes)
 ## For json reads, do we want to support other string formats defined in the 
RFC? The use case could be that someone has an uuid field previously in string 
format and switched to uuid format after it's added. but I guess that 
transition won't work for binary/compact protocols anyways so maybe we don't 
need to support that?

(also for naming, judging from the wikipedia page of 
[https://en.wikipedia.org/wiki/Universally_unique_identifier,] I think "uuid" 
is the more widespread accepted term)

> 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