Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Actually that's not true. Functions in Ruby aren't first class citizens, and for a given function you can't request / modify it's syntax tree.

Otherwise, I consider the blur between code and data a good thing to have.



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...


> And what language does let you do that?

Io does.

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).


Well, Lisp.

And even in C# 3.0, when passing lambda expressions you can request a syntax tree instead of a method reference.


Not 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.


Well, with ruby you can at least pretend they are, but yea.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: