You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Anatoly Kanivetsky (JIRA)" <ji...@apache.org> on 2011/03/31 17:36:06 UTC

[jira] [Created] (THRIFT-1126) Extending struct_info for erlang bindings

Extending struct_info for erlang bindings
-----------------------------------------

                 Key: THRIFT-1126
                 URL: https://issues.apache.org/jira/browse/THRIFT-1126
             Project: Thrift
          Issue Type: Improvement
          Components: Erlang - Compiler
            Reporter: Anatoly Kanivetsky
         Attachments: thrift-1086852.diff

In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.

In this patch i've added more type specifiers to generated records. 
Now it covers all possible types (I've forgot about list(), map() and #another_record{}).
It now initializes all record fields without default value with 'undefined'. 
This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).

Also in this patch adds generation of additional structure info, that might be useful from runtime.
It contains:
 * FieldID,
 * FieldReq,
 * FieldType 
 * Identifier
 * ConstValue

ConstValue is constructed everytime when struct_info_ext(...) is called. 
This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?

I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (THRIFT-1126) Extending struct_info for erlang bindings

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury reassigned THRIFT-1126:
-------------------------------------

    Assignee: Anthony Molinaro

Do you think you could sign off on this patch?

> Extending struct_info for erlang bindings
> -----------------------------------------
>
>                 Key: THRIFT-1126
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1126
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anthony Molinaro
>         Attachments: thrift-1086852.diff
>
>
> In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.
> In this patch i've added more type specifiers to generated records. 
> Now it covers all possible types (I've forgot about set(), map() and #another_record{}).
> It now initializes all record fields without default value with 'undefined'. 
> This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).
> Also in this patch adds generation of additional structure info, that might be useful from runtime.
> It contains:
>  * FieldID,
>  * FieldReq,
>  * FieldType 
>  * Identifier
>  * ConstValue
> ConstValue is constructed everytime when struct_info_ext(...) is called. 
> This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?
> I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (THRIFT-1126) Extending struct_info for erlang bindings

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/THRIFT-1126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13016561#comment-13016561 ] 

Hudson commented on THRIFT-1126:
--------------------------------

Integrated in Thrift #113 (See [https://hudson.apache.org/hudson/job/Thrift/113/])
    

> Extending struct_info for erlang bindings
> -----------------------------------------
>
>                 Key: THRIFT-1126
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1126
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anatoly Kanivetsky
>             Fix For: 0.7
>
>         Attachments: thrift-1086852.diff
>
>
> In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.
> In this patch i've added more type specifiers to generated records. 
> Now it covers all possible types (I've forgot about set(), map() and #another_record{}).
> It now initializes all record fields without default value with 'undefined'. 
> This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).
> Also in this patch adds generation of additional structure info, that might be useful from runtime.
> It contains:
>  * FieldID,
>  * FieldReq,
>  * FieldType 
>  * Identifier
>  * ConstValue
> ConstValue is constructed everytime when struct_info_ext(...) is called. 
> This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?
> I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (THRIFT-1126) Extending struct_info for erlang bindings

Posted by "Anthony Molinaro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anthony Molinaro resolved THRIFT-1126.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 0.7
         Assignee: Bryan Duxbury  (was: Anthony Molinaro)

I applied the patch then was looking at the generated code for the ConstantsDemo.thrift in the test directory and noticed that the constants for maps and sets seemed weird.  See if you can spot the problem with these

{noformat}
-define(constantsDemo_GEN_MAP, dict:from_list([(35532,233),(43523,853)])).
-define(constantsDemo_GEN_SET, sets:from_list([(235,true),(235,true),(53235,true)])).
{noformat}

Yeah, turns out if you actually try to use those you get errors, as 1, parens are not how you create tuples, and 2, then you use sets:from_list its also not what you expect (which as far as I am concerned this this case is a set with 2 elements as sets dedupe).

As far as I can tell complex constants probably never worked, guess that shows how much they are used :).

Anyway, I went ahead and fixed that bug and commited the patch.

Thanks again Anatoly!

> Extending struct_info for erlang bindings
> -----------------------------------------
>
>                 Key: THRIFT-1126
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1126
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>            Reporter: Anatoly Kanivetsky
>            Assignee: Bryan Duxbury
>             Fix For: 0.7
>
>         Attachments: thrift-1086852.diff
>
>
> In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.
> In this patch i've added more type specifiers to generated records. 
> Now it covers all possible types (I've forgot about set(), map() and #another_record{}).
> It now initializes all record fields without default value with 'undefined'. 
> This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).
> Also in this patch adds generation of additional structure info, that might be useful from runtime.
> It contains:
>  * FieldID,
>  * FieldReq,
>  * FieldType 
>  * Identifier
>  * ConstValue
> ConstValue is constructed everytime when struct_info_ext(...) is called. 
> This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?
> I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (THRIFT-1126) Extending struct_info for erlang bindings

Posted by "Anatoly Kanivetsky (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anatoly Kanivetsky updated THRIFT-1126:
---------------------------------------

    Attachment: thrift-1086852.diff

> Extending struct_info for erlang bindings
> -----------------------------------------
>
>                 Key: THRIFT-1126
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1126
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>            Reporter: Anatoly Kanivetsky
>         Attachments: thrift-1086852.diff
>
>
> In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.
> In this patch i've added more type specifiers to generated records. 
> Now it covers all possible types (I've forgot about list(), map() and #another_record{}).
> It now initializes all record fields without default value with 'undefined'. 
> This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).
> Also in this patch adds generation of additional structure info, that might be useful from runtime.
> It contains:
>  * FieldID,
>  * FieldReq,
>  * FieldType 
>  * Identifier
>  * ConstValue
> ConstValue is constructed everytime when struct_info_ext(...) is called. 
> This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?
> I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (THRIFT-1126) Extending struct_info for erlang bindings

Posted by "Bryan Duxbury (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Duxbury closed THRIFT-1126.
---------------------------------

    Assignee: Anatoly Kanivetsky  (was: Bryan Duxbury)

> Extending struct_info for erlang bindings
> -----------------------------------------
>
>                 Key: THRIFT-1126
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1126
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>            Reporter: Anatoly Kanivetsky
>            Assignee: Anatoly Kanivetsky
>             Fix For: 0.7
>
>         Attachments: thrift-1086852.diff
>
>
> In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.
> In this patch i've added more type specifiers to generated records. 
> Now it covers all possible types (I've forgot about set(), map() and #another_record{}).
> It now initializes all record fields without default value with 'undefined'. 
> This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).
> Also in this patch adds generation of additional structure info, that might be useful from runtime.
> It contains:
>  * FieldID,
>  * FieldReq,
>  * FieldType 
>  * Identifier
>  * ConstValue
> ConstValue is constructed everytime when struct_info_ext(...) is called. 
> This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?
> I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (THRIFT-1126) Extending struct_info for erlang bindings

Posted by "Anatoly Kanivetsky (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/THRIFT-1126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anatoly Kanivetsky updated THRIFT-1126:
---------------------------------------

    Description: 
In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.

In this patch i've added more type specifiers to generated records. 
Now it covers all possible types (I've forgot about set(), map() and #another_record{}).
It now initializes all record fields without default value with 'undefined'. 
This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).

Also in this patch adds generation of additional structure info, that might be useful from runtime.
It contains:
 * FieldID,
 * FieldReq,
 * FieldType 
 * Identifier
 * ConstValue

ConstValue is constructed everytime when struct_info_ext(...) is called. 
This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?

I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.

  was:
In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.

In this patch i've added more type specifiers to generated records. 
Now it covers all possible types (I've forgot about list(), map() and #another_record{}).
It now initializes all record fields without default value with 'undefined'. 
This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).

Also in this patch adds generation of additional structure info, that might be useful from runtime.
It contains:
 * FieldID,
 * FieldReq,
 * FieldType 
 * Identifier
 * ConstValue

ConstValue is constructed everytime when struct_info_ext(...) is called. 
This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?

I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.


> Extending struct_info for erlang bindings
> -----------------------------------------
>
>                 Key: THRIFT-1126
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1126
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Compiler
>            Reporter: Anatoly Kanivetsky
>         Attachments: thrift-1086852.diff
>
>
> In addition to recently fixed THRIFT-27, I've made some extra changes, if no one objects.
> In this patch i've added more type specifiers to generated records. 
> Now it covers all possible types (I've forgot about set(), map() and #another_record{}).
> It now initializes all record fields without default value with 'undefined'. 
> This is a bit redundant, but I like it. (maybe you're not? let me know if you have some objections!).
> Also in this patch adds generation of additional structure info, that might be useful from runtime.
> It contains:
>  * FieldID,
>  * FieldReq,
>  * FieldType 
>  * Identifier
>  * ConstValue
> ConstValue is constructed everytime when struct_info_ext(...) is called. 
> This isn't good, but perhaps, it is ok if erlang optimizes such things. Does it?
> I planned to use struct_info_ext(...) in further modifications of erlang thrift library, to implement runtime validation of presence of required fields during reading/writing, and to avoid encoding of optional fields with default values. But it is pretty usable of itself.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira