3 ms·
>- that they conform to the types required by the function >- then you have to check the return type of the function Those two things seems to be trivial, the
by tester756 5y ago
>- that they conform to the types required by the function
>- then you have to check the return type of the function
Those two things seems to be trivial, they're low hanging fruits, at least for "simple types", don't they?
>- to see if variables x, y, z are in scope
every node that can have "body" has its own scope and that scope has also parent scope which it receives from parent and it repeats
e.g function has body which has scope, and then there's if statement in that body, so "if scope" has body's scope as parent, thus receives all declared variable in function body
>- to do that you need to look up the function. Depending on your language it can be any of: available globally, imported from a module, aliased from a module, defined in the file, a variable holding a reference to the function
Nothing seems strange, I assume that whole source code is avaliable at compilation time.
>- so now, depending on your language you have to decide whether the type of the result of the function (which can be simple, imported global, subtype, union...) can be matched against the type of the variable
Definitely things will get more complicated once I stop doing stuff with just ints and bools and try to create complex type system, but for now stuff seems to be easy
- dmitriid 5y ago> but for now stuff seems to be easy I'm not saying it's hard. You've forgotten what the conversation started with.