Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Is use of a simple DSL for a configuration a good idea?

by rizzo (Curate)
on Oct 18, 2018 at 12:38 UTC ( [id://1224231]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Is use of a simple DSL for a configuration a good idea?
in thread Is use of a simple DSL for a configuration a good idea?

Yeah JSON sure sounds like a dsl

In my understanding is does not since JSON is not domain specific. Same thing with Lisp. Lisp is not a DSL, but Emacs Lisp is, since it's domain specific.

Replies are listed 'Best First'.
Re^4: Is use of a simple DSL for a configuration a good idea?
by LanX (Saint) on Oct 18, 2018 at 13:36 UTC
    I wouldn't call eLisp a DSL. True, it has a bunch of domain specific commands but is still a GPL (General Purpose Language).

    That's pretty much like with JS which has DOM specific commands but can still be used for other stuff (actually eLisp was the role model for all those embedded scripting languages° - Brendan Eich was originally hired by Netscape to create a Scheme like language)

    The best example for an (external) DSL is SQL. It is limited to a specialized domain, e.g. you will rarely see computer games realized entirely in SQL.

    But if you are an SQL expert you can contribute to Perl, Python or PHP projects, without knowing much of the host language.

    The case of this thread - Rex - is a configuration DSL realized "internally", i.e. by reusing language elements of the "host language" Perl. (SQL snippets are external strings)

    You don't need to know much Perl to be able to use this DSL.(pretty much like SQL-expert can patch SQL code in a Perl project)

    The advantage to JSON:

    • to catch typos or grammatical errors. In JSON you'd need to write a parser which descends the data structure (Kind of reinventing a DTD). But Rex's DSL the commands must be predefined and can validate the input immediately
    • you can extend this DSL to your needs by adding your own subs
    • it's more expressive, because Perl offers much more syntactic sugar than nested hashes/arrays have

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

    °) I only mentioned LISP because DSL's where invented there, especially with the use of reader macros* which bend the parser by overriding single symbols. For instance you can make LISP parse embedded JSON

    *) not to be confused with LISP's syntactic macros or even C's preprocessor macros.

Re^4: Is use of a simple DSL for a configuration a good idea?
by Anonymous Monk on Oct 19, 2018 at 01:06 UTC

    In my understanding is does not since JSON is not domain specific. Same thing with Lisp. Lisp is not a DSL, but Emacs Lisp is, since it's domain specific.

    Who defines the domain?

    A lot of people are confused like that

    Its in the name, javascript object notation

    Data format or domain specific language?

    format or language?

    data or code?

    Anyway you define it, any format/shape it takes, the monkey has to write the code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2024-03-28 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found