Hi, I have started writing a guide to metaprogramming called 'the way
of meta'. I have written only a draft intro and a simple example up
to now [1].
I wonder if there is much interest on the topic out there..
I have lots of material on metaprogramming and DSLs that I haven't
posted yet (still in a pretty raw format) and if I get a positive
response I'll start working on it and I will add it to the guide.
Hi, I have started writing a guide to metaprogramming called 'the way
of meta'. I have written only a draft intro and a simple example up
to now [1].
I wonder if there is much interest on the topic out there..
IMHO there definitely is.
I have lots of material on metaprogramming and DSLs that I haven't
posted yet (still in a pretty raw format) and if I get a positive
response I'll start working on it and I will add it to the guide.
Hi, I have started writing a guide to metaprogramming called 'the way
of meta'. I have written only a draft intro and a simple example up
to now [1].
I wonder if there is much interest on the topic out there..
I'm definitely interested in learning more about metaprogramming.
Mark
···
On Wednesday 19 April 2006 09:37, chiaro scuro wrote:
I have lots of material on metaprogramming and DSLs that I haven't
posted yet (still in a pretty raw format) and if I get a positive
response I'll start working on it and I will add it to the guide.
Metaprogramming looks to be extremely useful and interesting, but not
always the easiest thing to wrap your brain around.
Regards,
Brett
···
On 4/19/06, chiaro scuro <kiaroskuro@gmail.com> wrote:
Hi, I have started writing a guide to metaprogramming called 'the way
of meta'. I have written only a draft intro and a simple example up
to now [1].
I wonder if there is much interest on the topic out there..
I have lots of material on metaprogramming and DSLs that I haven't
posted yet (still in a pretty raw format) and if I get a positive
response I'll start working on it and I will add it to the guide.
Nice start
I fail to understand why tou define a method for each synonym though. Would
using method_alias instead not be a better choice?
Cheers
Robert
···
On 4/19/06, chiaro scuro <kiaroskuro@gmail.com> wrote:
Hi, I have started writing a guide to metaprogramming called 'the way
of meta'. I have written only a draft intro and a simple example up
to now [1].
I wonder if there is much interest on the topic out there..
I have lots of material on metaprogramming and DSLs that I haven't
posted yet (still in a pretty raw format) and if I get a positive
response I'll start working on it and I will add it to the guide.
I'll let you know when I post more about metaprogramming and DSLs.
thanks for your interest.
···
On 4/19/06, Mark Somerville <mark@scottishclimbs.com> wrote:
On Wednesday 19 April 2006 09:37, chiaro scuro wrote:
> Hi, I have started writing a guide to metaprogramming called 'the way
> of meta'. I have written only a draft intro and a simple example up
> to now [1].
>
> I wonder if there is much interest on the topic out there..
I'm definitely interested in learning more about metaprogramming.
Mark
> I have lots of material on metaprogramming and DSLs that I haven't
> posted yet (still in a pretty raw format) and if I get a positive
> response I'll start working on it and I will add it to the guide.
>
> [1] Liquid Development: The Way of Meta
>
> --
> Chiaroscuro
> ---
> Liquid Development: http://liquiddevelopment.blogspot.com/
the synonym is just an example, but it still serve a purpose, though.
alias clones a method, whereas synonym wraps it.
if the original method gets changed, synonym reflects this change,
whereas alias would ignore it.
···
On 4/19/06, Robert Dober <robert.dober@gmail.com> wrote:
On 4/19/06, chiaro scuro <kiaroskuro@gmail.com> wrote:
>
> Hi, I have started writing a guide to metaprogramming called 'the way
> of meta'. I have written only a draft intro and a simple example up
> to now [1].
>
> I wonder if there is much interest on the topic out there..
> I have lots of material on metaprogramming and DSLs that I haven't
> posted yet (still in a pretty raw format) and if I get a positive
> response I'll start working on it and I will add it to the guide.
>
> [1] Liquid Development: The Way of Meta
>
> --
> Chiaroscuro
> ---
> Liquid Development: http://liquiddevelopment.blogspot.com/
>
>
Nice start
I fail to understand why tou define a method for each synonym though. Would
using method_alias instead not be a better choice?
Cheers
Robert
--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.
} two people is already a crowd to me
}
} I'll let you know when I post more about metaprogramming and DSLs.
I only skimmed what you've written so far, but I noticed that you've used
class_eval. It is preferable to avoid any form of eval whenever possible.
In your post you can replace...
Array.class_eval do
synonym :size => [ :count, :n_elements ]
end
On Wed, Apr 19, 2006 at 06:31:47PM +0900, chiaro scuro wrote:
} two people is already a crowd to me
}
} I'll let you know when I post more about metaprogramming and DSLs.
I only skimmed what you've written so far, but I noticed that you've used
class_eval. It is preferable to avoid any form of eval whenever possible.
In your post you can replace...
Array.class_eval do
synonym :size => [ :count, :n_elements ]
end
I don't think instance_eval and class_eval, in their block forms, have
the same issues as plain eval(string). class_eval is really just a
closure cousin of the class keyword.
Could not agree more but I am desperately looking for a way to replace this
which I use *very* often
class Mine
eval <<-EOS
def #{name}( value, &block )
do_something( &block ) if block_given?
end
EOS
end
I'd *love* to do it with define_method, but I do not get around the "&block"
parameter.
Anybody help?
Thx
Robert
···
On 4/19/06, Gregory Seidman <gsslist+ruby@anthropohedron.net> wrote:
On Wed, Apr 19, 2006 at 06:31:47PM +0900, chiaro scuro wrote:
} two people is already a crowd to me
}
} I'll let you know when I post more about metaprogramming and DSLs.
I only skimmed what you've written so far, but I noticed that you've used
class_eval. It is preferable to avoid any form of eval whenever possible.
In your post you can replace...
--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.
what about using define_method from ruby1.8.4 ? it also accepts a
block as argument..
alternatively it will look nicer to use the eval %{ .... } notation
than the HEREDOC.
if you use heredoc you coud do it this way, to convey the meaning that
the sting represents code:
On 4/19/06, Robert Dober <robert.dober@gmail.com> wrote:
On 4/19/06, Gregory Seidman <gsslist+ruby@anthropohedron.net> wrote:
>
> On Wed, Apr 19, 2006 at 06:31:47PM +0900, chiaro scuro wrote:
> } two people is already a crowd to me
> }
> } I'll let you know when I post more about metaprogramming and DSLs.
>
> I only skimmed what you've written so far, but I noticed that you've used
> class_eval. It is preferable to avoid any form of eval whenever possible.
> In your post you can replace...
Could not agree more but I am desperately looking for a way to replace this
which I use *very* often
class Mine
eval <<-EOS
def #{name}( value, &block )
do_something( &block ) if block_given?
end
EOS
end
I'd *love* to do it with define_method, but I do not get around the "&block"
parameter.
Anybody help?
Thx
Robert
--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.
Could not agree more but I am desperately looking for a way to replace this
which I use *very* often
wait for 2.0
class Mine
eval <<-EOS
def #{name}( value, &block )
do_something( &block ) if block_given?
end
EOS
end
moulon% cat b.rb
#!/usr/bin/ruby
class Mine
define_method(:a) {|a, &b|
do_something(a, &b)
}
def do_something(a)
if block_given?
yield a
else
puts "no block #{a}"
end
end
end
what about using define_method from ruby1.8.4 ? it also accepts a
block as argument..
which is...
not the problem.
The problem is that the block -used to define the method- does not accept a
&block parameter for the method I want to define.
BTW it seems to me there was a post on this, but I failed to find it, sorry
if I am wasting bandwith.
Sorry if I was not clear on this.
Are we now chiari or still scuri?
Ciao
···
On 4/19/06, chiaro scuro <kiaroskuro@gmail.com> wrote:
I'd like to look into that but I've got to run to catch an airplane in
a few hours.
I'll look into it when I'm back if nobody has come up with an answer
by that time.
···
On 4/19/06, Robert Dober <robert.dober@gmail.com> wrote:
On 4/19/06, chiaro scuro <kiaroskuro@gmail.com> wrote:
>
> what about using define_method from ruby1.8.4 ? it also accepts a
> block as argument..
which is...
not the problem.
The problem is that the block -used to define the method- does not accept a
&block parameter for the method I want to define.
BTW it seems to me there was a post on this, but I failed to find it, sorry
if I am wasting bandwith.
Sorry if I was not clear on this.
Are we now chiari or still scuri?