--0015174c0f86cf4b270463a34ae8
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Matz has repeatedly and explicitly expressed that he did not want Ruby to
have macros. That might have changed, but I believe he repeated it recently
at LoneStar RubyConf. I believe Matz has argued that macros are too complex
for the average programmer...

-- Yehuda

2009/2/23 Charles Oliver Nutter <charles.nutter / sun.com>

> James M. Lawrence wrote:
>
>> After looking at a few ruby_parser examples, in just 40 lines of code
>> I was able to write a transformer which allowed me to define the
>> seamless locals_to_hash I wanted.  This runs on 1.8, 1.9, and jruby --
>> anything which runs ruby_parser (and limited to syntax supported by
>> ruby_parser).
>>
>
> Very intriguing! I think the use of ruby_parser is probably the best part,
> since it will run anywhere.
>
> The lack of a formal macro system in Ruby seems more and more to be a
> serious gap. Most people end up using eval as a poor-man's macro.
> Unfortunately, even on the fastest implementations eval is too slow for
> critical code (and on some, it's even slower since there's a compile cycle
> involved in addition to parsing). Also, because it's parsed at runtime,
> you're unlikely to catch syntax errors early enough.
>
> A formal macro system, especially one built upon Ruby's own syntax and
> using a preprocessor, would make it possible to have a syntax-checked and
> fast macro implementations.
>
> I wonder if there might not be some affordance for a cleaner syntax that's
> not entirely "pure Ruby" but reduces some of the overhead imposed by Ruby
> syntax? ruby_parser itself may likely be the most hackable parser
> implementation, so building a better macro syntax on top of it shouldn't be
> difficult. And if it works out, perhaps there could be "fast macro
> preprocessing" eventually built into Ruby proper.
>
> - Charlie
>
>
>
>
>


-- 
Yehuda Katz
Developer | Engine Yard
(ph) 718.877.1325

--0015174c0f86cf4b270463a34ae8
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Matz has repeatedly and explicitly expressed that he did not want Ruby to have macros. That might have changed, but I believe he repeated it recently at LoneStar RubyConf. I believe Matz has argued that macros are too complexor the average programmer...<br>
<br>-- Yehuda<br><br><div class="gmail_quote">2009/2/23 Charles Oliver Nutter <span dir="ltr">&lt;charles.nutter / sun.com&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">James M. Lawrence wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
After looking at a few ruby_parser examples, in just 40 lines of code<br>
I was able to write a transformer which allowed me to define the<br>
seamless locals_to_hash I wanted.      ⭭
anything which runs ruby_parser (and limited to syntax supported by<br>
ruby_parser).<br>
</blockquote>
<br></div>
Very intriguing! I think the use of ruby_parser is probably the best part, since it will run anywhere.<br>
<br>
The lack of a formal macro system in Ruby seems more and more to be a serious gap. Most people end up using eval as a poor-man&#39;s macro. Unfortunately, even on the fastest implementations eval is too slow for critical codeand on some, it&#39;s even slower since there&#39;s a compile cycle involved in addition to parsing). Also, because it&#39;s parsed at runtime, you&#39;re unlikely to catch syntax errors early enough.<br>

<br>
A formal macro system, especially one built upon Ruby&#39;s own syntax and using a preprocessor, would make it possible to have a syntax-checked and fast macro implementations.<br>
<br>
I wonder if there might not be some affordance for a cleaner syntax that&#39;s not entirely &quot;pure Ruby&quot; but reduces some of the overhead imposed by Ruby syntax? ruby_parser itself may likely be the most hackable parser implementation, so building a better macro syntax on top of it shouldn&#39;t be difficult. And if it works out, perhaps there could be &quot;fast macro preprocessing&quot; eventually built into Ruby proper.<br>

<br>
- Charlie<br>
<br>
<br>
<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Yehuda Katz<br>Developer | Engine Yard<br>(ph) 718.877.1325<br>

--0015174c0f86cf4b270463a34ae8--