You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Nathan Marz (JIRA)" <ji...@apache.org> on 2009/11/20 22:51:39 UTC
[jira] Created: (THRIFT-636) Create an "include" annotation
Create an "include" annotation
------------------------------
Key: THRIFT-636
URL: https://issues.apache.org/jira/browse/THRIFT-636
Project: Thrift
Issue Type: Improvement
Components: Compiler (Java)
Reporter: Nathan Marz
Priority: Minor
The intention of this idea is to minimize the amount of typing necessary to navigate thrift structures. The idea is to be able to "include" a field within a struct, like so (I don't know the syntax of Thrift annotations but this is the idea):
struct B {
1: required i32 f1;
2: required i32 f2;
}
struct A {
1: @include required B b;
2: required i32 field2;
}
If we have an instance of A named "a", we can access the inner B's fields by saying "a.get_f1()".
There's the obvious problem of name conflicts, but I think it's fine to leave it to the programmer to make sure the code is safe.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-636) Create an "include" annotation
Posted by "David Reiss (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780784#action_12780784 ]
David Reiss commented on THRIFT-636:
------------------------------------
So you are proposing that the object structure would stay the same and we would just add extra methods to save you from typing a.get_b().get_f1() (or a.b.f1 if you are not using the beans style)?
> Create an "include" annotation
> ------------------------------
>
> Key: THRIFT-636
> URL: https://issues.apache.org/jira/browse/THRIFT-636
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> The intention of this idea is to minimize the amount of typing necessary to navigate thrift structures. The idea is to be able to "include" a field within a struct, like so (I don't know the syntax of Thrift annotations but this is the idea):
> struct B {
> 1: required i32 f1;
> 2: required i32 f2;
> }
> struct A {
> 1: @include required B b;
> 2: required i32 field2;
> }
> If we have an instance of A named "a", we can access the inner B's fields by saying "a.get_f1()".
> There's the obvious problem of name conflicts, but I think it's fine to leave it to the programmer to make sure the code is safe.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (THRIFT-636) Create an "include" annotation
Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bryan Duxbury closed THRIFT-636.
--------------------------------
Resolution: Won't Fix
I think this would be somewhat clunky and inconsistent to use. If you'd like to submit a patch, feel free to reopen.
> Create an "include" annotation
> ------------------------------
>
> Key: THRIFT-636
> URL: https://issues.apache.org/jira/browse/THRIFT-636
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> The intention of this idea is to minimize the amount of typing necessary to navigate thrift structures. The idea is to be able to "include" a field within a struct, like so (I don't know the syntax of Thrift annotations but this is the idea):
> struct B {
> 1: required i32 f1;
> 2: required i32 f2;
> }
> struct A {
> 1: @include required B b;
> 2: required i32 field2;
> }
> If we have an instance of A named "a", we can access the inner B's fields by saying "a.get_f1()".
> There's the obvious problem of name conflicts, but I think it's fine to leave it to the programmer to make sure the code is safe.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (THRIFT-636) Create an "include" annotation
Posted by "Nathan Marz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12780820#action_12780820 ]
Nathan Marz commented on THRIFT-636:
------------------------------------
Yes, exactly. And I suppose the setters could automatically create an instance of the underlying object if it doesn't exist already.
> Create an "include" annotation
> ------------------------------
>
> Key: THRIFT-636
> URL: https://issues.apache.org/jira/browse/THRIFT-636
> Project: Thrift
> Issue Type: Improvement
> Components: Compiler (Java)
> Reporter: Nathan Marz
> Priority: Minor
>
> The intention of this idea is to minimize the amount of typing necessary to navigate thrift structures. The idea is to be able to "include" a field within a struct, like so (I don't know the syntax of Thrift annotations but this is the idea):
> struct B {
> 1: required i32 f1;
> 2: required i32 f2;
> }
> struct A {
> 1: @include required B b;
> 2: required i32 field2;
> }
> If we have an instance of A named "a", we can access the inner B's fields by saying "a.get_f1()".
> There's the obvious problem of name conflicts, but I think it's fine to leave it to the programmer to make sure the code is safe.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.