Closed mfiano closed 6 years ago
The stemcell thing was added to allow injection of bound 'global' vars as uniforms and to let a form's type be inferred from surrounding code (this is a bad way of doing it but that was the idea)
Allowing unbound wasnt part of the design so this is definitely needed in the current design.
If I allow unbound symbols then every variable typo becomes a stemcell which means that the compiler is way less useful as it never checks if a variable is bound, it just assumes it's a stemcell.
Previously we had the additional restriction that a injected variables would have to have earmuffs but that was removed at user request a while ago.
What about (setf allow-unbound-stemcell-variables t)
? The code would be tiny to support this.
Alternately, perhaps that check could be moved to CEPL? That would preserve the current behavior CEPL-side, where free variables are expected to refer to bound specials, but allow other wrappers around varjo to make their own decisions on this front.
If no stemcell type interence function is provided by a varjo user than any free variable is an error, IIRC, so it’s not like a direct varjo user could accidentally stumble into free variable weirdness without first learning something of how stemcells work, at which point it becomes a documentation problem.
Heya @djeis97, moving the logic sounds more sensible for sure. Maybe we can change it so that if the stemcell hook returns nil then varjo reports it as a unknown variable. I'd need to look into this as there is some old code there that might be relying on some dumb behavior.
Thanks for chipping in!
@djeis97 Done. Varjo no longer checks that the symbol is bound and instead will report it being undefined if the infer hook function returns nil.
Has been pushed to master. I hope this helps :)
Closing for now, but please reopen if this doesnt cover your use case
suitable-symbol-for-stemcellp
is checking for boundp, forcing me to use keyword symbols in vari for my uniform system to work correctly.