Skip to content
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

More fluent syntax for building strings. #59

Open
sageserpent-open opened this issue Mar 7, 2023 · 1 comment
Open

More fluent syntax for building strings. #59

sageserpent-open opened this issue Mar 7, 2023 · 1 comment

Comments

@sageserpent-open
Copy link
Owner

Currently, one builds a Trials<String> via something like this:

api().characters('a', 'z').collections(Builder::stringBuilder).

That is a bit prolix: it would be nicer to write:

api.characters('a', 'z').strings() instead, likewise collectionsOfSize should have a corresponding stringsOfSize analogue.

This requires a specialised form of Trials<Character> that possesses the magic methods.

@sageserpent-open
Copy link
Owner Author

sageserpent-open commented Mar 7, 2023

Now I remember why I didn't do this before - there is a lot of delegation from whatever implements CharacterTrials to usual trials implementation. Unless the implementation of TrialsApi is refactored to include some kind of flexible type on the trials it yields (analogous to how SupplyToSyntax is specialised for tuples), this is going to be very messy.

Could use ByteBuddy to set up a delegating proxy of type CharacterTrials that forwards on to the real implementation?

Maybe that second approach would also be useful in the context of #56?

Putting this on to the back burner for now...

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

When branches are created from issues, their pull requests are automatically linked.

1 participant