Stories
Slash Boxes
Comments

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chromatic (983)

chromatic
  (email not shown publicly)
http://wgz.org/chromatic/

Blog Information [technorati.com] Profile for chr0matic [technorati.com]

Journal of chromatic (983)

Thursday January 10, 2008
08:07 PM

Mature Poets Steal

[ #35356 ]

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
end

And 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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • looking at that, I think I'd rather use XML as in Torque (http://www.jajakarta.org/turbine/en/turbine/torque/user-guide.html)
    .
    --

    @JAPH = qw(Hacker Perl Another Just);
    print reverse @JAPH;
  • I can see from Piers Cawley [bofh.org.uk] that Perl is capable of writing good pidgin notation.

    Here's an idea. Instead of complaining about Ruby DSL's 24/7, show us how to write one in Perl.

    • Instead of complaining about Ruby DSL's 24/7...

      Exaggerate much?

      ... show us how to write one in Perl.

      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.

      • Yeah, but at least it's not just passing a string to sql.execute or whatever, so ruby gets a chance to complain before the database does.

        Nah... not exactly compelling as arguments go is it?
        • 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.

    • show us how to write one in Perl.

      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?