------ art_23176_11106981.1146529676216 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Not sure about the ATs. even if I don't mind them that much... if I unfocus my eyes they look like bullet points ;-) I have got this one working.. see if you can guess how.. recipe "eggs and bacon" do eggs = [2,:big] bacon = 3 the end I posted my solution here: http://liquiddevelopment.blogspot.com/2006/04/way-of-meta-part-iv-hijacking-local.html On 5/2/06, Ross Bamford <rossrt / roscopeco.co.uk> wrote: > > On Tue, 2006-05-02 at 05:11 +0900, chiaro scuro wrote: > > On 5/1/06, Jacob Fugal <lukfugl / gmail.com> wrote: > > > > > > On 5/1/06, chiaro scuro <kiaroskuro / gmail.com> wrote: > > > > I need to keep the equal signs. > > > > > > This is my big question; why do you need the equal signs? I see > > > nothing inherent about the "recipe" domain that makes the equal signs > > > necessary or even desirable. If you were willing to ditch them, a > > > whole slew of simpler and cleaner implementations are available. > > > > > I realize that would make it much easier in ruby. > > It's just that the equal signs make lots of sense to my DSL users. > (forget > > the recipes, it's just an example) > > In return for keeping the equals signs, would the users let you get away > with a few 'at' symbols? > > def recipe(name, &blk) > o = Object.new > o.instance_eval(&blk) > o.instance_variables.inject({}) do |h,s| > h[s[1..-1]] = o.instance_variable_get(s) > h > end > end > # => nil > > recipe "eggs and bacon" do > @eggs = [2,:big] > @bacon = 3 > end > # => {"bacon"=>3, "eggs"=>[2, :big]} > > (Though I'd really recommend most of the other ideas from this thread > over this). > > -- > Ross Bamford - rosco / roscopeco.REMOVE.co.uk > > > -- Chiaroscuro --- Liquid Development: http://liquiddevelopment.blogspot.com/ ------ art_23176_11106981.1146529676216--