By the way, Why does `i32` and `bool` (and several other types) become the same undistinguishable `binary` in JSON? Why do you send method names in plain text in a binary protocol? Why there's no inheritance of struct's in Thrift? Why Thrift has no obvious way to define methods on client (i.e. server to client calls)? Why C# runtime is blocking and single-threaded? Why sequence id is always zero? Why does csharp:async imply that I have a fresh version of C#, while it could've been done with callbacks? Why feature support table was updated two years ago? Why there're two JavaScript libraries? How do I use WebSockets in both of them? Where's proper API documentation? How do I determine in a Node.js server that two method calls were from the same client? Why did I have to report an issue via maillist that spams my inbox every day? Haven't you find more ancient technologies to get feedback? Why I've got no answer? What should I do with `version.h` in Visual Studio, finally? Why does Node.js generator create global variables that fail 'use strict' check?
Personally I'd better write my own serialization library than patch thrift once more. In a span of last two months I've rewritten C#, JS and JSON generators and runtime libraries due to numerous bugs and missing features. The real question is if Gajanan H wants to fix the library that is certainly not ready for even basic usage. 2015-10-01 18:18 GMT+03:00 Jens Geyer <[email protected]>: > Generics do not have anything to do with it. golang supports this on the lgg > level and lacks generics big time. > > Btw, If you want generics, we accept patches. > ________________________________ > Von: Philip Polkovnikov > Gesendet: 01.10.2015 14:26 > An: [email protected] > Betreff: Re: How to return more than one value in a Thrift service method? > > Hello Gajanan, > > It's a pity that Thrift doesn't support generics, because it would ideally be > > struct Status<T> { > 1: StatusCode Code, > 2: T Value > } > > service ImportantService { > Status<ImportantData> GetImportantData() > } > > The absence of generics lower code reuse, because there's no way to > generically handle StatusCode's if there're methods with several > return value types. I've heard that generics was thought to be not a > very good idea due to a lack of generics (or static typing at all) in > most of supported languages, and one would need to create proxy types. > Protobuf.net uses this workaround for generics. It generates proxies > like List_Int32. Thrift already has some builtin support for lists and > maps, and we could abstract implementation approach from these. > > Another solution would be at least to create a pair<T, U> builtin > type. That would allow us to write > > struct Status { > 1: StatusCode Code > /* extension is possible here */ > } > > service ImportantService { > pair<ImportantData, Status> GetImportantData() > } > > So in case you're concerned with this issue, you could add any of > these features into a generator for the languages you need. We had a > need for attributes on fields and structs in production, so we've > added support into C# and JSON generators, and it was quite easy. > Generator's source code is pretty simple, it's written in a small > subset of C++ without extra dependencies. > > 2015-10-01 14:24 GMT+03:00 Randy Abernethy <[email protected]>: >> Hello Gajanan, >> >> Many consider it a best practice to return a struct in thrift service >> methods. This allows you to return multiple values and to evolve the things >> returned over time. Adding new attributes to a thrift struct is a backwards >> compatible operation. >> >> Best, >> Randy >> >> On Thu, Oct 1, 2015 at 3:32 AM, Gajanan H <[email protected]> wrote: >> >>> Hi, >>> >>> I have a thrift service method `ImportantData GetImportantData()` defined >>> in the IDL. I would like to return a Status code for this method. I would >>> like to be doing some thing like `Status GetImportantData(ImportantData&)` >>> >>> Is there a way to do that ? Pardon me I am very new to Thrift. BTW I am >>> using C++ as language. >>> >>> Regards, >>> Gajanan >>>
