[spec] Doc s/gen overrides do not take effect inside custom generators

Description

Custom generators may build (via fmap/bind) on spec generators. Generator overrides at the top level will not take effect inside custom generators:

Should consider documenting this in s/gen, s/with-gen, etc.

Environment

clojure 1.9.0-alpha14

Activity

Show:
Alex Miller
January 3, 2017, 11:39 PM

When you use with-gen, you're basically overriding the built-in gen mechanism (which supports overrides) and providing your own (opaque to spec) generator. You should not expect overrides to take effect inside a custom generator.

import
January 3, 2017, 11:41 PM

Comment made by: mullr

That makes sense, but in lieu of that I expected (and went looking for) some way to get at the overrides map from the function passed to s/with-gen, and found none.

import
January 3, 2017, 11:48 PM

Comment made by: mullr

... I didn't fully parse your comment the first time around. I can see from the implementation that a custom generator (gfn internally) is never passed any of the contextual information that the builtin specs have at hand. As it sounds like this is intentional, it would be useful to note this limitation in the docstring for s/gen or perhaps s/with-gen.

Alex Miller
January 3, 2017, 11:58 PM

It's not a crazy idea, but it doesn't seem like there's any way this could be done in the current impl without some pretty significant changes.

Assignee

Unassigned

Reporter

import

Approval

None

Patch

None

Affects versions

Priority

Minor
Configure