I've been thinking of writing a simple gem that something similar to
the unix remind(1) program, which prints out reminders for the current
date based on a rather complex specification. I've been thinking of
using YAML to store the individual reminders, but then started to
think about using a DSL instead. The examples I've seen make a DSL
somewhat compelling in this regard.
Example remind(1) reminder:
REM April 1 MSG APRIL FOOLS!
The remind syntax can get quite interesting:
REM [ONCE] [date_spec] [back] [delta] [repeat] [PRIORITY prio] [SKIP |
BEFORE | AFTER] [OMIT omit_list] [AT time [tdelta] [trepeat]] [SCHED
sched_function] [WARN warn_function] [UNTIL expiry_date] [SCANFROM
scan_date] [DURATION duration] [TAG tag] <MSG | MSF | RUN | CAL |
SATISFY | SPECIAL special | PS | PSFILE> body
Ouch.
So I was thinking of a DSL that could make that a bit simpler.
Then, something else I've been thinking of started worming in. I work
with some wiki software (http://pmwiki.org) that is built in PHP. It
utilizes flat file store, instead of a DBMS, and the file format looks
like:
version=pmwiki-2.2.43 ordered=1 urlencoded=1
author=
charset=UTF-8
csum=
host=127.0.0.1
name=Main.HomePage
rev=212
text=Welcome to {$Title}, ....
.
.
.
Looks like it could be YAML, no?
Then I thought, why not write it as a DSL?
So then my question arises: what's the boundary here? DSL's make it
easy *for people* to write instructions of some kind, but they can
also be used to structure data -- the infamous PBJ sammich keeps
cropping up. How apocryphal is this example? Does it make sense to use
a DSL as a data store? In the wiki example above, the only parts that
a wiki author would be writing are the data elements, not the
structure.
When Would it make sense to store generated information as a DSL?