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

Noble Paul commented on THRIFT-122:
-----------------------------------

For WildCard types in C++ a dumb proposal.
{code}
class WildCard {
    std::string idl_name; //the name as in idl
    void* data; // a pointer let the user typecast and use it . This is how 
java users use it.just that java 
                // makes it easy by with instanceof . If somebody knows well 
what to expect it becomes even easier
}
{code}

So if  {{list<?>}} is the type the generated code can put it as 
{{list<WildCard>}}.

It is not very elegant but it should work.Considering the fact that somebody is 
using this feature , most likely is is using languages like java, so it should 
be OK.

My knowledge of C++ is quite dated correct me if I am wrong

> Allow heterogeneous collections
> -------------------------------
>
>                 Key: THRIFT-122
>                 URL: https://issues.apache.org/jira/browse/THRIFT-122
>             Project: Thrift
>          Issue Type: New Feature
>            Reporter: Noble Paul
>
> Currently thrift only supports homogeneous collections . But , that is very 
> restrictive for many languages which allows heterogeneous collections. It 
> does not have to be supported in BinaryProtocol The new DenseProtocol may add 
> support for this
> implementation details 
> the IDL can allow syntax 
> {code}
> list<?>
> set<?>
> map<?,?>
> map<?,the-type>
> map<the-type,?>
> {code}
> While writing down data use a type modifier to say whether key (1), value(2) 
> or both(3) are wild cards
> for a List/Set use a type modifier 1 to specify that it is heterogeneous
> If it is a homogeneous collection do it the way it is done now.
> Or else
> add type information just before the data. So it adds an extra byte/element 
> For ma

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to