foxfriends / lumber

Embeddable logic scripting language
5 stars 1 forks source link

Non-record/list values in record/list tail position #32

Open foxfriends opened 3 years ago

foxfriends commented 3 years ago

It is currently possible to cause Lumber to crash by getting a non-record/non-list value into a record/list tail:

test(A, B) :- B <- { a: a, ..A }.
:- test(a, B).

This causes Binding::apply to fail when attempting to extract the value of B.

There is some sort of checking that needs to be done when constructing a list/record that the tail value is valid. There is currently no such construction check. Inserting a step into the generated body right before constructing the record (or before evaluating the body, in the case of a record in head position) could work, but there is still no way to represent that check, maybe until #5.