3 ms·
Ruby aids and abets designing your own syntax But... how? Can you give an example? And by isomorphic, I mean that, given a finite number of "utilities" one co
by ced 18y ago
Ruby aids and abets designing your own syntax
But... how? Can you give an example?
And by isomorphic, I mean that, given a finite number of "utilities" one could translate line for line a Ruby program into a Python program, and still get, maybe not a fully Pythonic program, but close enough. I thought, using this metric, C < Python, Ruby < Lisp
- raganwald 18y agoI have found a remarkable proof that Ruby aids and abets writing your own domain-specific languages, but the margin is too small to write it out. Actually, I have found this to be true and you will also find the OP makes this exact point. Google ruby and DSL and you will find hundreds of examples. While argumentum ad popularum is a fallacy, I think we have are safe in saying Ruby encourages this. Whether the resulting DSLs are any good is another question. And by isomorphic, I mean that, given a finite number of "utilities" one could translate line for line a Ruby program into a Python program, and still get, maybe not a fully Pythonic program, but close enough. I thought, using this metric, C < Python, Ruby < Lisp I don't think this is true. I have a strong feeling that Ruby allows certain things that would require whole-program rewriting to redo in Python, and certainly the reverse is true. Generators from Python and the various metaprogramming callbacks from Ruby come to mind. Certainly you can translate from one to the other, but I don't think the resulting rewriting will be entirely local.