2 Dynamic Scope
Your colleague at work has seen some pirated videos from the Brown course CSCI 1730. In these videos they have heard that dynamic scope is a bad idea. Not having attended Brown and taken such a course, however, they don’t understand why.
Your job is to construct a small (one to three) number of programs that can help persuade them. You can assume that they are familiar with the smol/hof language (which was also pirated out of Brown). The SMoL library also contains the language smol/dyn-scope-is-bad, which has the same syntax as smol/hof but has a dynamic scope semantics.
Ideally, you would produce programs that syntactically differ only in the
#lang line and evaluate differently under the two semantics, where the
behavior under dynamic scoping is an unpleasant surprise. (Thus, this is like
working with mystery languages, but instead of merely classifying
languages—
Please turn in a single file with all the code. Use comments to separate the programs if you have multiple of them. Please also write a comment after each program that mentions what happens under each semantics, and tell your colleague what is surprising. (In Racket, you can use #| … |# to delimit multi-line comments.) Ideally, you would have examples that are materially different (i.e., not just different variable names) from those you have already seen in class and in the textbook.