Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: the disadvantages of mini-languages

by aufflick (Deacon)
on Feb 06, 2005 at 23:26 UTC ( #428534=note: print w/replies, xml ) Need Help??


in reply to the disadvantages of mini-languages

I have often been through similar frustrations. It's one of the reasons that I like HTML::Mason.

Mini-languages basically bring greater structure or different forms of expression. They definately have a place, but I think they can be over-used.

HTML templating, though, is one place where I think they have value. If you believe that there shouldn't be any significant logic in the template files, then an enforced mini-language is good. Also if your template writers are html types using dreamweaver, then a well designed mini-language designed to look like tags (cf. Apache::ASP, Aolserver).

Another benefit can be a different form of expression. Not that SQL is a mini-language, but as an embeded language it holds benefit because some things are better represented by declarations.

One pet peeve about the over-use of mini-languages is config files. There are SO many config file formats, and you often can't do what you want, so you write bogus scripts to read and edit them for you (cf. cobalt qube). I once blogged that Tcl is an ideal config file language: it is simple to embed; simple to learn; and if you don't need any evaluation in your config, then the file will look like a simple text format config file.

(Of humerous note: the thing that prompted my blog entry was discovering, to my painful amusement, that the sendmail.cf format is turing complete...)

I guess my point here is not that mini-languages are bad, but that there are too many poorly concieved re-inventions - if you think you need a mini-language, why not use an existing one like ASP or Tcl.

  • Comment on Re: the disadvantages of mini-languages

Replies are listed 'Best First'.
Re^2: the disadvantages of mini-languages
by hardburn (Abbot) on Feb 07, 2005 at 14:28 UTC

    The point of a mini domain-specific lanugage is to make a single task really, really easy. You almost certainly have a host language, but you're choosing not to use that because it doesn't make that single task really, really easy.

    Imagine if, every time you wanted to parse text, you had to build your own Finite State Machine, node-by-node. You could hardly get any work done. Fortunately, Perl provides a regular expression domain-specific langauge that builds the FSM for you.

    Would replacing regexen with Tcl help? No, not at all. Deal with it :)

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

      Regular expressions are a GOOD example of where domain-specific languages are beneficial.

      A turing complete sendmail.cf is a domain-specific language gone BAD.

      Apache rewrite rules, for example, use regular expressions - that is good. They could have invented their own language to match urls - that would have been bad.

      Should I have added "or SQL or regular expressions" to the last sentance of my original comment?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://428534]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2019-10-16 19:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?