3 ms·
Why should local bindings use let? In scheme internal (define ...) is defined in terms of letrec, which can add some overhead when letrec is unoptimized, but fo
by bjoli 7y ago
Why should local bindings use let? In scheme internal (define ...) is defined in terms of letrec, which can add some overhead when letrec is unoptimized, but for schemes with optimized letrec (guile 3.0, chez, racket...) (define ...) is just as fast as let or let* unless you start doing cyclic references.
The only real reason to not use Def would be if the bound symbol escapes the scope, but that would be ridiculous for a modern language.
- nickik 7y agoIn Clojure 'def' creates a 'var' and those are global in the namespace. > The only real reason to not use Def would be if the bound symbol escapes the scope, but that would be ridiculous for a modern language. Its not 'ridiculous' to have a consistent definition of what something does.
- pepper_sauce 7y agoIt does exactly what the documentation says it does: "Creates and interns or locates a global var with the name of symbol and a namespace of the value of the current namespace (ns)."