views:

168

answers:

2
+1  Q: 

Format vs Language

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.

+1  A: 

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 voor misinterpretation.

So you can say that they don't need to evolve because they already are languages.

I used the following definitions:

  • HRF (Human Readable Format), almost anything in written format.
  • DSL (Domain Specific Language), language used for a single purpose.

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 behaviour (sequences, decissions based on data) hav ethe potential to evolve into a language.

Gamecat
I was afraid someone would say that. But have added clarification ;)
dirkgently
I said `a programming language' in the sense that there is a framework that'd allow you to go on without changing the basic elements. And no, I don't mean the mainstream programming languages like C++ :) HRF is limited and requires constant monitoring?
dirkgently
Added a clarification.
Gamecat
'So you can say that only languages that describe behaviour (sequences, decissions based on data) hav ethe potential to evolve into a language.' -- I'm confused!
dirkgently
Yes. Because else you don't have much use for loops.
Gamecat
'languages that describe behaviour' are already languages. Hence my confusion. Loops etc were examples, points of reference.
dirkgently
Are you suggesting DSL is a subset of HRF? This discussion would have little value in that case.
dirkgently
+1  A: 

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 no 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:

  • Is textual (potentially human readable) or binary (very hard for human readers) better (with the whole ineroperability aspect in there).
  • When does a format become a DSL.

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.

Richard
Think you have a lot of good ideas brimming -- care to elucidate?
dirkgently
Expanded... but maybe not helpfully :-)
Richard
No, actually it makes sense, for me at least. We are having this huge fight over what to implement. A DSL or just a HRF file. Sometimes these definitions can come back to bite you (long after the project has been dumped ;)
dirkgently
Good! Now re-reading this a few days later, I think one can easily get too tied up in trying to define something that really doesn't need a definition in detail. More important is that it is a useful and effective approach to meeting your requirements.
Richard