thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James E. King, III (JIRA)" <>
Subject [jira] [Commented] (THRIFT-2939) JavaScript generated code for Node and browser is different
Date Sun, 09 Apr 2017 02:35:41 GMT


James E. King, III commented on THRIFT-2939:

I found this towards the beginning of the PR backlog and it looked fairly small, so I applied
it and it failed.  If anyone wants to pick up the effort to finish this, please feel free
to do so.  It's probably pretty close to working, but I don't know the language / rules well

> JavaScript generated code for Node and browser is different
> -----------------------------------------------------------
>                 Key: THRIFT-2939
>                 URL:
>             Project: Thrift
>          Issue Type: Improvement
>          Components: JavaScript - Compiler, JavaScript - Library
>    Affects Versions: 0.9.2
>            Reporter: Radoslaw Gruchalski
>              Labels: javascript, patch
> The generated code for regular JS differs from NodeJS code. NodeJS uses direct return
values from {{read<Type>()}} while regular JS code expects a value from {{read<Type>()}}
to be an object with {{.value}} property.
> This makes it impossible to share generated code between browser JS and NodeJS. The fix
is rather simple:
> - do not append {{.value}} in generated code while accessing values read from protocol
/ transport
> - do not return an object with the value property from {{read}}, return result read
> I am not sure why such difference. Both environment implementations take an input, which
is a protocol, and execute the same read methods. There is no need to have an additional complexity
in regular JS.

This message was sent by Atlassian JIRA

View raw message