tomhrr / dale

Lisp-flavoured C
BSD 3-Clause "New" or "Revised" License
1.02k stars 48 forks source link

Disable escaping from namespaces for inner functions (#208) #210

Closed ChengCat closed 5 years ago

ChengCat commented 5 years ago

The namespace escaping behaviour has been removed, and a new machanism for checking invalid variable reference is added.

This is mostly done, and the error reporting could be improved:

I tackle this issue (#208) first instead of #201, because this seems to be easier, and it's more urgent for my use.

tomhrr commented 5 years ago

Thanks for this, it looks good. The only change I'd like to make is to drop the ReferenceVariableInDifferentFunction error, because it works differently from the existing 'variable not in scope' errors, and those existing errors will be displayed whenever the new errors are displayed anyway. Does that sound OK?

ChengCat commented 5 years ago

Thanks for the feedback. I originally added that error, because my mental model is that the variable is in the scope, but can't be referenced as a value. (Function scope is viewed as a compiler implementation detail.) I have removed the error, and changed VariableNotInScope's error message to indicate the different possible cause. Does it look OK?

tomhrr commented 5 years ago

Yep, these changes look good, thanks.