[ANN] New Ruby Implementation - RBXML

B

Brad Ediger

Ruby is a wonderful language, but its syntax has some shortcomings.
Inspired by Perl, the syntax of Ruby requires many special cases and
is difficult to parse by anything but a full Ruby interpreter. We seek
to fix this issue with a new, unambiguous syntax for Ruby: RBXML.

"Business Reporting and XML go hand in hand. I plan to convert Ruport
to RBXML as soon as I can!"
-- Gregory Brown, Ruby Reports maintainer

<http://www.bradediger.com/blog/2008/04/a_modest_syntax_proposal_rbxml.html<http://tinyurl.com/23elz5>

===========

Consider the following Ruby code. While it is certainly concise, it
achieves this goal through use of obscure symbols such as . and |.
This makes it difficult to read, and more importantly, difficult to
parse by machine.

class Integer
def factorial
(1..self).inject(1) {|p, x| p*x}
end
end

Rubyists talk a lot about metaprogramming, but how are you supposed to
introspect on a language like that? Some projects try to work around
these limitations by letting Ruby code introspect on itself; however,
the result can be unwieldy. Why reinvent the wheel when XML has been
around for years? Consider the much more regular and understandable
syntax in RBXML:

<class name="Integer">
<def name="factorial">
<method-call>
<name>inject</name>
<receiver>
<range exclude-end="false">
<start>
<integer>1</integer>
</start>
<end>self</end>
</range>
</receiver>
<argument>
<integer>1</integer>
</argument>
<block>
<parameter name="p" />
<parameter name="x" />
<code>
<method-call>
<name>*</name>
<receiver>p</receiver>
<argument>x</argument>
</method-call>
</code>
</block>
</method-call>
</def>
</class>

Just as languages in the Lisp family represent their parse trees with
s-expressions, this regular syntax represents the parse tree directly,
with only a small bit of XML parsing. Rubyists now have the advantage
of not having an extra layer of syntax between them and their concepts.

===========

To read more, visit:

<http://www.bradediger.com/blog/2008/04/a_modest_syntax_proposal_rbxml.html<http://tinyurl.com/23elz5>

===========

Brad Ediger
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Ruby and object paradigm 7
[ANN] Detective - a new ruby gem 8
ANN main-4.4.0 0
ANN: Ruby Underscore 0.1.0 Released 4
New to Ruby...help needed 1
ANN: Sequel 3.13.0 Released 0
New Version 0
[ANN] main-3.0.1 0

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top