Uses for Dynamic Languages

前端 未结 13 2069
刺人心
刺人心 2021-01-02 11:14

My primary language right now is D, and I\'m in the process of learning Python because it\'s required for a course I\'m taking. While I understand why dynamic languages wou

13条回答
  •  忘掉有多难
    2021-01-02 11:26

    I was going to say closures but found this thread... (not that I understand how it would work in a "static" language)

    Related concepts are functions-as-first-class-objects and higher-order procedures. (e.g. a function that takes a function as input and/or returns a function as output)

    edit: (for the nitpickers here) I'll echo a comment I made on @David Locke's post. Dynamically-interpreted languages make it possible to use an existing software program/project in conjunction with a small function or class created at the spur-of-the-moment to explore something interactively. Probably the best example is function graphing. If I wrote a function-graphing object with a graph(f,xmin,xmax) function, I could use it to explore functions like x2 or sin(x) or whatever. I do this in MATLAB all the time; it's interpreted and has anonymous functions (@(x) x^2) that can be constructed at the interpreter prompt to pass into higher-order functions (graphing functions, derivative operators, root finders, etc).

提交回复
热议问题