Lecture 4 Notes

6 6 8 5

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: tions, we say if and only if any environment that supplies bindings for the declarations of also supplies bindings for the declarations for . This can be assured if contains a matching declaration for every declaration in , as in the example above. § ¦ ¢&¡ £  ¦  ¢&¡ £ § ¢&¡ £ ¦  § ¢&¡ £ ¦  § ¢&¡ £ ¦¢&¡ £  ¦  ¦  ¡ © ¤¦¢&¡ £ " £  ¦  ¢&¡ £ " ¢ ¡ % £ " © ¢ Last, we must write . If we did not have type inference in our language, this would be a simple equality test. However, since we do have type inference, we must deal with the possibility that we may have type variables in our types. For example, in $ ¤ § " ¤£  ¡  % '  $ § £ © ¢ ¢ £ ©   £ % £  ¡ © ¤&£  ¡ ¡  © "  !¤¡ £ © ¡  ¡ ¦¤¢ ¥£¡  reported by the type inference engine will be something like , and we will need to conclude that . This is correct, since the polymorphic function can be used as an . On the other hand we should reject the assertion . To accomplish this task, performs a recursive traversal of the two types, much like the unifier does. As it walks through the types, it collects information about the substitution of each type variable to make sure that type variables are substituted consist...
View Full Document

This document was uploaded on 03/17/2014 for the course CSG 111 at Northeastern.

Ask a homework question - tutors are online