Konstantin created THRIFT-5840:
----------------------------------

             Summary: Add support for custom generic types (definition time)
                 Key: THRIFT-5840
                 URL: https://issues.apache.org/jira/browse/THRIFT-5840
             Project: Thrift
          Issue Type: Improvement
          Components: Compiler (General)
    Affects Versions: 0.21.0
            Reporter: Konstantin


It would be great to have custom generics support. (Like existing set<> list<>)
Generics probably should exist only in definition & compilation time. For 
example:

{code:c#}
// definiton
struct PagedList<T> 
{
 1: list<T> Collection 
 2: i32 PageSize
 3: i64 PageNumber
 4: i64 TotalCount
}

struct Nullable<T> 
{
1: T Value
}
// usage
enum SomeTypes 
{
 Type1 = 1
 Type2 = 2
}

struct Data 
{
 1: string Name
 2: i32 Age
 3: string Blabla
}

service AService 
{
  PagedList<Nullable<SomeTypes>> GetPagedTypes (1: i64 pageNumber, 2: i32 
pageSize) // etc
 PagedList<Data> GetPagedData(1: i64 pageNumber, 2: i32 pageSize) 
}
{code}

that would generate generic types where it is possible, and types like 
PagedListData (or DataPagedList etc) in case if there is no generics support.

Right now it's required to define those PagedListData manually, which is 
annoying and requires some extra effort.

What do you think?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to