Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Add support for DUs #70

Open
tjaskula opened this issue May 9, 2017 · 10 comments
Open

Add support for DUs #70

tjaskula opened this issue May 9, 2017 · 10 comments

Comments

@tjaskula
Copy link

tjaskula commented May 9, 2017

Hi, I didn't find any sample on that one, but would be nice to have serialization of Discriminated Unions

@7sharp9
Copy link
Collaborator

7sharp9 commented Jul 2, 2018

I don't think this is in scope for froto as it stands. Im also assuming you mean oneOf types. I have a custom solution to this where the code from froto.parser/serialiser is used with a custom code generator to produce F# record/unions. Its doubtful I could fold this back into this solution as it uses parse tree generation rather than the .Net 1 era generation of type providers which is pretty poor.

@ctaggart
Copy link
Owner

ctaggart commented Jul 2, 2018

@7sharp9 I have a renewed interest in actually making a froto .NET global tool that can do the code generation #15, especially if it will lead to gRPC generation eventually #90. I think we may have to boot the type provider code back out if it is not going to be maintained #76. It would be nice if it was maintained, but I'm not interested in it personally. cc @takemyoxygen

@takemyoxygen
Copy link
Collaborator

@ctaggart I still hope I will work on the type provider improvements at some point but it's not my priority at the moment. I guess, extracting the type provider back into a separate repository is the best way to go - you will be able to focus on code generation and maybe at some point I will catch up with the type provider.

@ctaggart
Copy link
Owner

ctaggart commented Jul 3, 2018

@takemyoxygen Or just add it back here when you have time. I'm fine either way.

@7sharp9
Copy link
Collaborator

7sharp9 commented Jul 3, 2018

@ctaggart Thats actually what I did, except Im using froto.parser to parse the proto3 file, then using proto.serializer along with quite a lot of the type provider code. Some of it is heavily modified, I also added DU generation for the oneOf fields.

The big difference is Im not using any of the type provider mechanism just the provided type structure and quotations as a basis of creating an ast, which is then written to a .fs file.

@ctaggart
Copy link
Owner

ctaggart commented Jul 3, 2018

@7sharp9 Yes, that is what I want. Any chance you are going to add a PR with that work?

@7sharp9
Copy link
Collaborator

7sharp9 commented Jul 3, 2018

@ctaggart Its been talked about, I would like to rework more of the quotation parts as they struggle with representing F# without loosing too much information, like infix/prefix on operator calls and also no pattern matching as its removed by the quotation translator.

@7sharp9
Copy link
Collaborator

7sharp9 commented Aug 29, 2018

Pretty soon the oneOf code will be open source but its entirely a code generator rather than a type provider, it shares a similar implementation, I used the type provider code as reference but changed a lot of it and added further pieces to it.

@ctaggart
Copy link
Owner

I like code generators. Looking forward to seeing it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants