Quick question about typespeccing

Is there a way to tell dialyzer that a variable is a module that takes a certain behaviour? (As opposed to “just a module”?)

A module name is just an atom, so nope there isn’t. You can’t even be sure the name is actually one, where there’s module loaded or available to be loaded.

4 Likes

I didn’t think there was. Dialyzer doesn’t know anything a priori in general, and can’t check that typespecs are being adhered to, so I don’t see a fundamental reason why you couldn’t typespec module values with their behaviors, at the very least, so that you can see that internal function calls have correct arity and types, and that passed function calls match the behaviour