Some people were asking for a way to change table schemas easily, so I came up with a DSL for doing that, so you can do stuff like:
alter_table
:items
add_column:name, :text, :unique => true
drop_column:category
endAnd Sequel will generate the correct SQL for you.
Sequel Interview with Sharon Rosner (emphasis mine)
For a second that looked a lot like another language I knew, and then I looked more closely. Silly me. Those leading colons make all the difference.
hmm (Score:2)
.
@JAPH = qw(Hacker Perl Another Just);
print reverse @JAPH;
Well? (Score:2)
Here's an idea. Instead of complaining about Ruby DSL's 24/7, show us how to write one in Perl.
Re: (Score:1)
Exaggerate much?
I'll do you one better. Take off the leading colons, turn
end into a semicolon, and HEY LOOK IT'S SQL WITH SIGILS.Sharon merely uglified an existing, perfectly working DSL. Some invention.
Re: (Score:1)
Nah... not exactly compelling as arguments go is it?
Re: (Score:1)
It's an advantage though, and if there's cross-database goodness hidden behind the API, that's an advantage too.
Of course, I worked on a project with something similar in 1999, and SQL was around before that, so anyone who didn't invent relational theory (or write a SQL database used by multiple people and projects) who claims to have come up with the syntax comes across as somewhat pretentious.
Re: (Score:1)
I think chromatic’s entire point is that “DSLs” are just “APIs,” except sprinkled with a magic pixie dust that no one has the will or capacity to define, past the fact that hash keys in great quantities are involved. “I know it when I see it” seems to exhaust the substance of the difference.
So how does one reproduce something undefinable?