--00163662e5eaede98a04c002a89d
Content-Type: text/plain; charset=ISO-8859-1

On Mon, May 14, 2012 at 12:17 PM, Marc Heiler <lists / ruby-forum.com> wrote:

> > What should I make to show off metaprogramming?
>
> The first thing is to laugh into the face of anyone who is
> "metaprogramming".
>
> Metaprogramming is a fashion run that is hopefully soon dying out.
>
> It is synonymous to admit that whoever is using "meta" to solve
> any given problem in Ruby there is:
>
> (a) no better solution (which would be sad, ruby is such a great
> language)
> (b) an ego boost to show off how to solve problems in convoluted and
> ugly ways
> (c) the bane of KEEPING THINGS SIMPLE, in an ever rising complexity for
> marginal gains
>
> I don't say that "metaprogramming" has no valid use cases. For example,
> I tend to use a config object for my projects, which allows one to call
> any method on it, and that object tries to make sense of it when
> possible.
>
> But that is really nothing "meta" I can see here.
>
> Meta is the new Agile - buzzwords with no values that will die soon.
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
Honestly, metaprogramming is just programming. It's consistent with what
you do everywhere else in Ruby. The real metaprogramming is anything that
involves a keyword. When you think about what that stuff does, it's really
crazy. But since we're accustomed to it, we don't notice so much.

I don't think metaprogramming adds that much overhead. Things like
method_missing and const_missing are the ones that add actual overhead for
me, because they're invisible when reflecting on the object. But defining
methods doesn't seem crazy to me. The struct example I provided doesn't
seem complex, you're just asking for a class with a specific set of
methods, and a known initializer and set of behaviours.

class_eval and instance_eval can also add complexity as things that seem
like benign refactorings can break due to unexpected method lookups.

Honestly, using modules to create large inheritance structures seems much
more problematic to me. When the entire world is loaded into your
environment, you can't think about one thing without thinking about
everything. The overhead associated with this is tremendous, and for me
greatly exceeds any pain I've felt from dynamically adding / responding to
methods.

-Josh

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

On Mon, May 14, 2012 at 12:17 PM, Marc Heiler <span dir="ltr">&lt;<a href="mailto:lists / ruby-forum.com" target="_blank">lists / ruby-forum.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">&gt; What should I make to show off metaprogramming?<br>
<br>
</div>The first thing is to laugh into the face of anyone who is<br>
&quot;metaprogramming&quot;.<br>
<br>
Metaprogramming is a fashion run that is hopefully soon dying out.<br>
<br>
It is synonymous to admit that whoever is using &quot;meta&quot; to solve<br>
any given problem in Ruby there is:<br>
<br>
(a) no better solution (which would be sad, ruby is such a great<br>
language)<br>
(b) an ego boost to show off how to solve problems in convoluted and<br>
ugly ways<br>
(c) the bane of KEEPING THINGS SIMPLE, in an ever rising complexity for<br>
marginal gains<br>
<br>
I don&#39;t say that &quot;metaprogramming&quot; has no valid use cases. For example,<br>
I tend to use a config object for my projects, which allows one to call<br>
any method on it, and that object tries to make sense of it when<br>
possible.<br>
<br>
But that is really nothing &quot;meta&quot; I can see here.<br>
<br>
Meta is the new Agile - buzzwords with no values that will die soon.<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Posted via <a href="http://www.ruby-forum.com/" target="_blank">http://www.ruby-forum.com/</a>.<br>
<br>
</div></div></blockquote></div><br><div>Honestly, metaprogramming is just programming. It&#39;s consistent with what you do everywhere else in Ruby. The real metaprogramming is anything that involves a keyword. When you thinkbout what that stuff does, it&#39;s really crazy. But since we&#39;re accustomed to it, we don&#39;t notice so much.</div>
<div><br></div><div>I don&#39;t think metaprogramming adds that much overhead. Things like method_missing and const_missing are the ones that add actual overhead for me, because they&#39;re invisible when reflecting on the object. But defining methods doesn&#39;t seem crazy to me. The struct examplerovided doesn&#39;t seem complex, you&#39;re just asking for a class with a specific set of methods, and a known initializer and set of behaviours.</div>
<div><br></div><div>class_eval and instance_eval can also add complexity ashings that seem like benign refactorings can break due to unexpected method lookups.</div><div><br></div><div>Honestly, using modules to create large inheritance structures seems much more problematic to me. When the entireorld is loaded into your environment, you can&#39;t think about one thingithout thinking about everything. The overhead associated with this is tremendous, and for me greatly exceeds any pain I&#39;ve felt from dynamically adding / responding to methods.</div>
<div><br></div><div>-Josh</div>

--00163662e5eaede98a04c002a89d--