3 ms·
Functions in Ruby aren't first class citizens... You can assign them to a variable, and you can write out a function literal. What more does it take to be a "f
by andreyf 18y ago
Functions in Ruby aren't first class citizens...
You can assign them to a variable, and you can write out a function literal. What more does it take to be a "first-class citizen"?
...for a given function you can't request / modify it's syntax tree
And what language does let you do that? Macro systems like let you do it at compile-time, but when you use the phrase "request an AST", it sounds like you're doing it at runtime...
- pygy 18y ago> And what language does let you do that? Io does. http://hackety.org/2008/01/05/ioHasAVeryCleanMirror.html http://hackety.org/2008/01/05/ioHasAVeryCleanMirror.html But functions are first class objects in Ruby (with some quirks regarding the difference between a proc and a bloc).
- bad_user 18y agoWell, Lisp. And even in C# 3.0, when passing lambda expressions you can request a syntax tree instead of a method reference.
- snprbob86 18y agoNot at runtime... This occurs at compile time by assigning to a variable of type Expression. F#, like OCaml, supports proper quotation and allows you to create executable code, or ASTs, or both using metadata attributes that the compiler is aware of.