6.01 Lecture Notes - Lecture 10: Indium Phosphide, Init

3 views11 pages

Document Summary

[spyeval(x, env) for x in form[1:]], f. environment)) else: Well, we still need implementations of the envi- ronment and function classes, but that"s not very much more work. We can add a simple object-oriented facility to spy, which is modeled on python"s oop facility, but is somewhat simpler. The crucial idea here is that classes and instances are both environments, of exactly the same kind that we have been using to support binding and function calls in basic spy. We only have to add two new syntactic features to the language: attribute lookup and class de - nition. In python, when you want to get the value of an attribute a from an instance obj, you say obj. a. Remembering that an instance is an environment, all we have to do to evaluate such an expression is to look up the symbol "a" in the environment "obj".

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions