Reputation: 111150
Elsewhere on the SO universe a storm has been raging for a some time now. On whether humans should prefer something they can read vis-a-vis something they can't. Which made me take my thinking hat out after a long hiatus and pose a question for the enlightened:
When do formats evolve into a domain specific language? Or, how do I decide if I want a Human Readable Format or a Domain Specific Language. PostScript is what came to mind that sparked this off.
PS: Excuse the prologue; mod-down/close if this has been asked already. PPS: When I say language, I really mean a programming language with conditions, loops etc.
Upvotes: 1
Views: 575
Reputation: 53366
When do formats evolve into a domain specific language? Or, how do I decide if I want a > HRF or a DSL. PostScript is what came to mind that sparked this off.
Every kind of format can be seen as a language. Because it needs rules to understand the message. Computer readable languages need to be fully specified with no room for misinterpretation.
So you can say that they don't need to evolve because they already are languages.
I used the following definitions:
If you restrict the definition of languages to only include programming languages which contains loops and branches. The story changes. Simple INI files don't need these constructs. But macro languages do. So you can say that only languages that describe behavior (sequences, decisions based on data) have the potential to evolve into a language.
Upvotes: 1
Reputation: 109045
Really depends on why a human might want to read it.
Many potentially readable formats (e.g. HTML) can be extremely hard to read when machine generated.
Anyway, real programmers read core dumps for breakfast :-)
As to the question of language, this will depend on definition (and "DSL" is not solidly defined). I would say a element of execution is required (how ever vaguely) and if it is simply a binary serialisation of data then I would not call that a language (e.g. many raster formats).
Considering this further, there seems to be two underlying interrelated questions here:
While the first question is covered elsewhere it cannot be completely separated from the latter. After all there are DSLs held in binary formats (e.g. Word macros), and DSLs that can be compiled (e.g. .NET SDK includes a tool to convert XSLT to an assembly).
Which leads me to think the real question posed is: what is that makes a format a DSL. And the problem here is that "DSL-ness" is very much in the eye of the beholder and context dependent.
Is HTML a DSL? Is HTML with event handler properties and JavaScript a DSL? The first is arguable, and latter is hard to say no to because program code is definitely used.
My initial reaction to this question was to consider to be a DSL requires some form of directed execution. I.e. in processing the DSL the application modifies its operation. This is, on further reflection, too broad a definition. Consider a Word processing application with no-macros. The loaded document manifestly dominates the state of the application and drives its performance.
This leads to a second potential definition based on human authoring to specify instructions directly in the language to direct an (or class of) application. This however is pretty vague. But at least avoids the WP document being a DSL.
Thus, my current answer: does it matter? A DSL or a format is a tool to get computers to do things, academic definitions don't really progress that activity.
Upvotes: 2