Definitions Declarations - SICP Comparison Edition" /> 4.1.6   Internal <span style="color:green">Definitions</span> <span style="color:blue">Declarations</span> - SICP Comparison Edition
Original JavaScript
Original JavaScript
Original JavaScript
Original JavaScript
Original JavaScript
Original JavaScript

[1] Wanting programs to not depend on this evaluation mechanism is the reason for the management is not responsible remark in footnote 4 of chapter 1. By insisting that internal definitions come first and do not use each other while the definitions are being evaluated, the IEEE standard for Scheme leaves implementors some choice in the mechanism used to evaluate these definitions. The choice of one evaluation rule rather than another here may seem like a small issue, affecting only the interpretation of badly formed programs. However, we will see in section 5.5.6 that moving to a model of simultaneous scoping for internal definitions avoids some nasty difficulties that would otherwise arise in implementing a compiler.
[2] The IEEE standard for Scheme allows for different implementation strategies by specifying that it is up to the programmer to obey this restriction, not up to the implementation to enforce it. Some Scheme implementations, including MIT Scheme, use the transformation shown above. Thus, some programs that don't obey this restriction will in fact run in such implementations.
[3] This example illustrates a programming trick for formulating recursive functions without using assignment. The most general trick of this sort is the $Y$ operator, which can be used to give a pure $\lambda$-calculus implementation of recursion. (See Stoy 1977 for details on the lambda calculus, and Gabriel 1988 for an exposition of the $Y$ operator in the language Scheme.)
[4] The MIT implementors of Scheme support Alyssa on the following grounds: Eva is in principle correct—the definitions should be regarded as simultaneous. But it seems difficult to implement a general, efficient mechanism that does what Eva requires. In the absence of such a mechanism, it is better to generate an error in the difficult cases of simultaneous definitions (Alyssa's notion) than to produce an incorrect answer (as Ben would have it).
[5] The designers of JavaScript support Alyssa on the following grounds: Eva is in principle correct—the declarations should be regarded as simultaneous. But it seems difficult to implement a general, efficient mechanism that does what Eva requires. In the absence of such a mechanism, it is better to generate an error in the difficult cases of simultaneous declarations (Alyssa's notion) than to produce an incorrect answer (as Ben would have it).
[6] This example illustrates a programming trick for formulating recursive procedures without using define. The most general trick of this sort is the $Y$ operator, which can be used to give a pure $\lambda$-calculus implementation of recursion. (See Stoy 1977 for details on the lambda calculus, and Gabriel 1988 for an exposition of the $Y$ operator in Scheme.)
4.1.6   Internal Definitions Declarations