Live data from Hacker News

Ruby DSL Handbook

clean-ruby.com

1–10 of 30 posts

Re: Ruby DSL Handbook

#4
I think it needs a foreword: "your problem likely is nowhere near needing a DSL, please don't write one just because it makes you look clever".

Signed: everyone who's ever used a DSL which could have been written better as a couple of dozen functions.

Re: Ruby DSL Handbook

#5

I think it needs a foreword: "your problem likely is nowhere near needing a DSL, please don't write one just because it makes you look clever". Signed: everyone who's ever used a DSL which could have been written better as a couple of dozen functions.

That you suffered from DSL is probably a sign that this book will be filling a gap :-)

I had /some/ bad experiences with some DSL, but most of my experiences with them were pretty good (even those who I didn't write).

Re: Ruby DSL Handbook

#6

I think it needs a foreword: "your problem likely is nowhere near needing a DSL, please don't write one just because it makes you look clever". Signed: everyone who's ever used a DSL which could have been written better as a couple of dozen functions.

Almost any problem can be meaningfully and usefully solved by introduction of a DSL. It's a remarkably flexible technique.

Ruby is a really bad language to write good DSLs in. Metaprogramming is an awkward replacement for better DSL facilities.

Maybe this book can demonstrate better techniques?

Re: Ruby DSL Handbook

#7
post #6

I think it needs a foreword: "your problem likely is nowhere near needing a DSL, please don't write one just because it makes you look clever". Signed: everyone who's ever used a DSL which could have been written better as a couple of dozen functions.

Almost any problem can be meaningfully and usefully solved by introduction of a DSL. It's a remarkably flexible technique. Ruby is a really bad language to write good DSLs in. Metaprogramming is an awkward replacement for better DSL facilities. Maybe this book can demonstrate better techniques?

Isn't the DSL just an ad-hoc implementation of a rules engine in many cases?

Re: Ruby DSL Handbook

#8
post #6

I think it needs a foreword: "your problem likely is nowhere near needing a DSL, please don't write one just because it makes you look clever". Signed: everyone who's ever used a DSL which could have been written better as a couple of dozen functions.

Almost any problem can be meaningfully and usefully solved by introduction of a DSL. It's a remarkably flexible technique. Ruby is a really bad language to write good DSLs in. Metaprogramming is an awkward replacement for better DSL facilities. Maybe this book can demonstrate better techniques?

Interesting, that runs counter to the prevailing sentiment that Ruby's metaprogramming makes it great for writing DSLs. What language features do you prefer for writing DSLs?

Re: Ruby DSL Handbook

#9

I think it needs a foreword: "your problem likely is nowhere near needing a DSL, please don't write one just because it makes you look clever". Signed: everyone who's ever used a DSL which could have been written better as a couple of dozen functions.

That you suffered from DSL is probably a sign that this book will be filling a gap :-) I had /some/ bad experiences with some DSL, but most of my experiences with them were pretty good (even those who I didn't write).

"most of my experiences with them were pretty good (even those who I didn't write)." - lol, gotta love programmer arrogance, I'm guilty as well.

I can't remember the joke but the tagline goes, "Code I didn't write" anyone?

Re: Ruby DSL Handbook

#10
I've never been a fan of using "DSL" in the context of Ruby. Sure, you can do some metaprogramming, but you cannot create new syntax, change order of evaluation, etc., which I feel is a fundamental requirement for creating real EDSLs. One simple consequence of this is that you end up having to quote a lot of things.
Post reply on HN