ReasonablyTyped icon indicating copy to clipboard operation
ReasonablyTyped copied to clipboard

Progress on v2

Open baransu opened this issue 6 years ago • 2 comments

First of all - amazing project 🎉Making it solid and robust will allow Reason community to grow very rapidly, allowing adoption in many existing projects. Thank you for all your work!

I want to integrate Reason into my current React (with flow) project. The main obstacle is creating bindings to components library. It's around 30 components I have to creating bindings for so nothing huge to do manually but it would be better to create automated solution.

I was playing with current version and the initial output is good but have to be updated manually to latest ReasonReact/Reason/Bucklescript version. I saw there is 2 folder with experimental branch with the new compiler so I started playing with it. It's very early stage and it's missing a lot of features yet.

Some stuff I was improving https://github.com/Baransu/ReasonablyTyped/commit/c3e347790968da54a66d5dd9d26a398521aa815d#diff-ad87cfcd8f69e5ca9743bdb78cc3bf81 but not sure if it's good direction.

Could you create some small tasks to grab and work on in free time? I really want to contribute but having no guidelines nor roadmap for version 2 doesn't help.

baransu avatar Jul 27 '18 22:07 baransu

Hey there 😄

So the repo is kinda of a mess right now. I've been experimenting a lot with some new techniques, and a lot of cool stuff has come out of it 🙂One of the big things I've realized when making ReasonablyTyped is Reason code is really hard to generate from anything that isn't native code, and even then it's still difficult. Even after that code is generated, it's hard to keep up to date with best practices for binding to JS idioms too 😕This makes it hard for even humans to write good bindings!

I've been working on what I think is a pretty cool solution to this I've been calling Dre. It's a human writable, machine targetable language for outputting Reason bindings. It started out as a kind-of fork of ReasonablyTyped, but I eventually just ended up taking inspiration from it. Dre is going to be the next-gen Reason emitter for ReasonablyTyped, by way of ReasonablyTyped targeting Dre instead of raw Reason.

As far as the conversion story, Dre should make things a lot easier 😄The syntax is the same as Flow's, but with entirely different semantics. This means ReasonablyTyped from Flow -> Reason just becomes a Babel plugin! Even TS -> Reason is just a Babel plugin now that it Babel supports TypeScript!

Sorry to bum you out, but it's going to be some time before all of this is ready 😿I'm writing it fast, but there's only so much I can do 😉One great way to help out would be to start a "3" folder implementing a Babel plugin to generate idiomatic Dre from Flow and TypeScript code. I can add you as a collaborator if you want to start on that work 🎉

In the meantime, I'm going to keep on working on Dre and make it better than ReasonablyTyped ever was by itself. I'm really focusing on things like great error messages, editor integration, and great semantics from the output, things ReasonablyTyped always had to compromise on because it was bound to Flow. But now that the core Reason emit stage has been removed, Dre should be able to generate really good bindings, meaning ReasonablyTyped should be able to soon too!

Anyway, I think some of the main things that are going to need work for ReasonablyTyped (3? idk, 2 was never really completed) are:

  • Inlining union types into function arguments (Dre won't support that)
  • Normalizing Flow export syntax to just declare syntax
  • Normalizing export default from Flow
  • TypeScript stuff somewhere too
  • Correcting variable casing, because Dre will only support uppercase interfaces and lowercase type aliases

That should be a good start!

rrdelaney avatar Jul 28 '18 06:07 rrdelaney

@rrdelaney Thanks for all of your work here. I haven't seen anything activity recently on the project and am wondering if it's still maintained?

painedpineapple avatar Aug 16 '19 16:08 painedpineapple