comrak icon indicating copy to clipboard operation
comrak copied to clipboard

Builders for options

Open kivikakk opened this issue 4 years ago • 3 comments
trafficstars

I keep breaking semver compatibility by adding options. Change public-facing options to builders so adding an option is backwards-compatible.

I'm not super sold on this variety of builder, namely the way you need to call options.x for several xs if you want to modify multiple kinds. Maybe I could roll all the builder functions into one impl.

kivikakk avatar Feb 15 '21 00:02 kivikakk

Hey, If you're still interested in adding a builder implementation, what do you think of using https://crates.io/crates/derive_builder for this? That will generate the builder automatically, and one won't have to remember to specifically add a corresponding builder function. Also for the semvar-breaking issue, what do you think of adding non-exhaustive attribute to the options structs? That way they cannot be manually instantiated, and won't break others depending on them.

YJDoc2 avatar Oct 23 '21 13:10 YJDoc2

Oh yeah, that seems way better. Making them non-exhaustive also seem really good; possibly could just go with that instead entirely. I don't really have the time in life to make either of these happen myself at the moment, but would certainly appreciate help going in either direction.

kivikakk avatar Oct 24 '21 05:10 kivikakk

Hey, I would like to help and maybe send a PR if you'd be willing to review it and accept it. Let me know. The builder option would provide an easier way to build options rather than having type each of the struct option/ use ... . The non-exhaustive would allow extending the options without breaking the depending crates, as it would force them to have a _ option in match. Both seem a good thing to add. Let know which ones would you like to add.

YJDoc2 avatar Oct 24 '21 07:10 YJDoc2

@YJDoc2 Sorry I never replied to your comment! Life got a lot.

I'd be very happy to accept such a PR. Let me know if this is something you still have any interest in taking on — and I understand it might not be, of course, given the passage of time — otherwise I'll likely get to it soon while tidying up Comrak.

kivikakk avatar Mar 29 '23 07:03 kivikakk

Hey, no worries! :smile:

I am still interested in helping out, but I'll need to take another look at what I was suggesting as I seem to have forgotten that myself :joy:

Also, I am a bit busy with other stuff at the moment as well, so how about this : I will try to get a PR opened up as I can, that adds the suggested builder stuff ; but in case you get to tidying up before it, feel free to continue with it and close this as appropriate.

In case you need a more concrete timeline, let me know, I'll try to get it done sooner, or just pass on it :+1:

YJDoc2 avatar Mar 29 '23 10:03 YJDoc2

@kivikakk Opened #292 , please take a look!

YJDoc2 avatar Mar 29 '23 12:03 YJDoc2