-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make deriver #1
base: main
Are you sure you want to change the base?
Make deriver #1
Conversation
This reverts commit 8aa7321.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this implementation @ayc9 , it looks great! And sorry for the delay in reviewing (as you know, I was on vacation).
I only have one important question: why is this still marked as a draft? :) I think it's ready/very close to being ready to be merged! I've only looked over the first part so far and have left some minor comments; all of that is just nitpicking and nothing is important/blocking (in fact, you don't even need to take the suggestions if you don't agree).
Just one thing that I find a bit more important: It would be good to add something like "deriver make:" at the beginning of each error message. For example "deriver make: "We cannot expose functions that explicitly create private records.". That's just to make clear that the error doesn't come from the compiler, but from the deriver, when the user encounters it. Btw, it looks really good how you've embedded the errors!
P.S.: One thing that has called my attention: if I understand correctly, find_main
does not only separate the arguments into the main argument and the other arguments but also turns around the order of the other arguments (which is needed later). Is that right? If so, it might be nice to somehow make that clear in the code to avoid confusion. I might come back to that later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ayc9 , once again: thanks for this great PR! I've just had a look at the tests as well and they all also look good, so I'm already approving the PR. There's one kind of test that might be worth adding: records with type parameters, i.e. something along the lines
type 'a t = {a: 'a option } [@@deriving make]
but like all the other comments, that's nothing important/blocking. Let me know if you want to look into some of the comments or if you want me to merge like this :)
Co-authored-by: Sonja Heinze <[email protected]>
Co-authored-by: Sonja Heinze <[email protected]>
This is an implementation of the
make
PPX deriver, based on previous implementations and updated using latestppxlib
API. The deriver works on record types, and supports@main
and@default
annotations on specific fields within the record type. Usage is documented in the readme. Special attention is needed for:@main
on anoption
type)Thank you!