Taz A.

asked • 05/12/21

Dynamic Scoping

Early implementations of the Lisp language employed dynamic scoping, but modern Racket implementations do not. This turns out to have important implications for abstraction and modularity. Specifically, dynamically-typed systems can interfere with our expectation that the implementation of the body of a function is not relevant to code that calls upon that function. I.e., if we have a call like (sqrt 16), we don't actually care which algorithm is used to compute a square root, or how that algorithm is expressed, e.g., via recursion or a loop, as long as a correct algorithm and implementation are chosen. Explain how dynamic scoping can break this expectation for some code (hint: consider what could happen if someone changes a higher-order function like map or foldl).

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.