diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-05-04 06:28:47 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-05-04 06:28:47 -0700 |
commit | ea5484fd84635136a6ebfc68b79dd838bc150c8f (patch) | |
tree | c937f140041ec85ef4ebe9445d88f4c8d962e93f /stream.c | |
parent | 90f5aae6185214f77c8566500a94af264015b60b (diff) | |
download | txr-ea5484fd84635136a6ebfc68b79dd838bc150c8f.tar.gz txr-ea5484fd84635136a6ebfc68b79dd838bc150c8f.tar.bz2 txr-ea5484fd84635136a6ebfc68b79dd838bc150c8f.zip |
structs: check existence of type in new and lnew.
This achieves two objectives. The obvious one is that we get
a diagnostic for new expressions that name a nonexistent type,
due to a typo, before those expressions are executed.
However, this also fixes an annoying issue: spurious warnings
about nonexistent slots, related to structs which have not
yet been autoloaded. A test case for this is an expression
like (let ((b (new list-builder))) b.(add 42)). Because
list-builder is auto-loaded, the add slot doesn't exist.
But (new list-builder) doesn't trigger that auto-load; so
the deferred warning about the nonexistent slot isn't
suppressed. With this change, the existence check in
(new list-builder) will trigger the auto-load for the module
which defines list-builder, causing the add slot to exist
before the b.(add 42) expression is visited by the expander.
* share/txr/stdlib/struct.tl (sys:check-struct): New function.
(new, lnew): Issue warning if the type doesn't exist.
Diffstat (limited to 'stream.c')
0 files changed, 0 insertions, 0 deletions