Seelengrab / Supposition.jl

A Julia implementation of choice sequence based PBT, inspired by Hypothesis
https://seelengrab.github.io/Supposition.jl/
European Union Public License 1.2
28 stars 1 forks source link

[UX]: "An argument doesn't have a generator set!" #37

Open jariji opened 2 months ago

jariji commented 2 months ago

What happened?


julia> Supposition.@check function checkassociativeinstance(a::Data.Floats(),b::Data.Floats(),c::Data.Floats())
       (a + b) + c == a + (b + c)
       end
ERROR: LoadError: ArgumentError: An argument doesn't have a generator set!
in expression starting at REPL[13]:1

How could this be communicated better?

It says "An argument doesn't have a generator set!" but

Julia Version

julia> versioninfo()
Julia Version 1.10.0
Commit 3120989f39b (2023-12-25 18:01 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 24 × AMD Ryzen 9 3900XT 12-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver2)
  Threads: 17 on 24 virtual cores
Environment:
  JULIA_NUM_THREADS = 12

Package Environment

(@main) pkg> st Supposition
Status `~/.julia/environments/main/Project.toml`
  [5a0628fe] Supposition v0.3.1
Seelengrab commented 2 months ago

The syntax is a=Data.Floats(), not a::Data.Floats(); i.e. you're assigning/setting a to use elements from Data.Floats(). It's not a type assertion, because Data.Floats() is not a type, and you can reuse properties defined in this way with other generators that produce other element types.

Would "An argument doesn't have a generator assigned!" be better? I'm using exclamation marks here to indicate a critical problem, not to yell (yelling would be "AN ARGUMENT DOESN'T HAVE A GENERATOR ASSIGNED!").

jariji commented 2 months ago

Ideally it would recognize this :: vs = syntax mistake specially and tell me. In https://github.com/Seelengrab/Supposition.jl/issues/2 I apparently thought of :: too so I figure this won't be the last time somebody makes this mistake.

The next best thing might be

argument a has no Possibility assigned. Try a=Data.Just(3) or similar.

(Maybe giving an example is pushing it too far.) But using the word Possibility instead of "generator" seems good, since that's what's missing.

As for the !, we're in an error message so I already know it's a failure: I prefer a calmer experience - just the facts.