4 ms·
> But I wouldn't call Scheme a dynamic language! Care to elaborate?
by euccastro 15y ago
> But I wouldn't call Scheme a dynamic language!
Care to elaborate?
- kragen 15y agoScheme operations are mostly early-bound, even more so than Common Lisp; you standardly use vector-ref or string-ref, for example, instead of nth. (There are Schemes where this is not true, such as RScheme, but Racket is not among them.) Vectors aren't resizable; for that kind of thing, you must use lists. You can't attach arbitrary properties to some arbitrary object, the way you can in JS or Ruby. You can't introduce new variable bindings in the middle of a block. (What you do instead is make a new nested block.) Finite maps (assoc, make-hash-table) are second-class citizens. Standard Scheme is nonreflective; you're supposed to do your metaprogramming with macros, not reflection and interposition. (I don't know how much reflection Racket supports, but I'd guess almost none.) The object-literal syntax is quasiquote, which is clumsy. It does have dynamic typing, but that's not what it means to be a "dynamic language". Dynamic languages are late-bound; everything is up for grabs at runtime. In standard Scheme, this is true in the fairly useless sense that everything depends on the bindings in the global namespace, so you could in theory (set! car somethingweird), but this is very rarely practical; it almost serves only to make optimizing Scheme compilers difficult to write. Aside from that, the language leans much further toward early binding, doing things at compile-time, and using efficient data structures at the cost of flexibility.
- euccastro 15y agoI don't think the meaning you give to "dynamic" here has much bearing on the difficulty of just-in-time compilation, except for reflection. In Scheme you can define and create new functions and macros at runtime. There is not much else that is dynamic about the Scheme standard[1] because... there's not much else to the Scheme standard. As for reflection, I see that mainly as a tools/debugging aid, and therefore very implementation-specific stuff. "Dynamic" languages have reflection in their definition because they are mostly defined by implementation. That said, the Scheme standard doesn't preclude reflectivity at all, nor seems particularly compile-oriented to me. Nowhere it is assumed that implementations be compilers at all. I think most of the things you find missing there were not left out for efficiency, but because it was rightly considered that they don't belong in the language spec at all. [1] By the "Scheme standard" I mean R5RS.
- kragen 15y agoI agree, none of these features have much to do with the difficulty of just-in-time compilation. The stellar performance results Mike Pall is getting with LuaJIT, which has all of those features, kind of prove that. They do, however, have a lot to do with the usability and dynamic feeling of a language. This makes their absence from most Schemes less understandable. > As for reflection, I see that mainly as a tools/debugging aid You can use it that way, but you can also use it for metaprogramming. > "Dynamic" languages have reflection in their definition because they are mostly defined by implementation. Plausible. > That said, the Scheme standard doesn't preclude reflectivity at all, nor seems particularly compile-oriented to me. Nowhere it is assumed that implementations be compilers at all. True.
- swannodette 15y agoMost of the things you've said I imagine don't apply to Racket, I didn't say anything about Scheme in my original post.
- kragen 15y agoWell, I imagine they do, but I'd be interested in finding out whether my imagination is misleading me. Which things I said don't apply?