lexi-lambda / struct-update

5 stars 3 forks source link

Configurable separators #4

Open greghendershott opened 7 years ago

greghendershott commented 7 years ago

Would you consider a PR that lets the user supply the separators used in format-id (as opposed to them being hardcoded as hyphens)?

I ask because sometimes I find struct-super-field-with-hyphens-set hard to parse visually. Using hyphens was of course the best default choice -- no complaint there! But a user might prefer names like any of:

struct.super.field-with-hyphens.set
struct:super:field-with-hyphens.set
struct/super/field-with-hyphens/set

or whatever floats their boat?


I'm imagining define-struct-updaters would accept optional #:struct-suffix and #:operator-prefix items, and the values could be anything matching the id syntax class.

For instance (define-struct-updaters some-struct #:struct-suffix : #:operator-prefix .) would produce the second example, struct:super:field-with-hyphens.set.

lexi-lambda commented 7 years ago

I think I’d be open to this idea. I admit I never actually use this package, and I generally avoid struct subtyping, so I have not personally run into the problem that this change would solve, but I believe you if you say it is a problem, and I don’t see any obvious alternative solutions. I consider this package to be essentially in maintenance mode from my point of view, so I am unlikely to implement any new features myself, but I would certainly accept a PR that included something like this.