foxfriends / lumber

Embeddable logic scripting language
5 stars 1 forks source link

Opt-in occurs check #54

Open foxfriends opened 3 years ago

foxfriends commented 3 years ago

Prolog does not use the occurs check by default because it is very slow. With some quick testing, I have determined that by not using occurs check in Lumber, significant performance improvements can be made. If we make occurs-checking opt-in (at the language level) that should help with performance. New syntax ("pattern with occurs check") will be required, maybe this is where the # comes in?

X =:= [X].  // pass
#X =:= [X].  // fail
X =:= #[X].  // fail
X =:= [#X].  // fail
foxfriends commented 3 years ago

I have disabled occurs check entirely for now. It's just too slow for it to be used always. The option to opt-in to the occurs check should be added at some point... I don't think the # syntax will work, maybe a keyword occurs?