On Mon, Jul 15, 2013 at 1:37 AM, Martin Blais <[email protected]> wrote:

> "Is the ledger file a computer language or is it a file format?"


A very interesting question. I think it can be both.

TLDR; it can be a declarative, Domain Specific Language.

A declarative language allows the specification of what is needed, and but
doesn't allow the specification of how to achieve it. It is intentionally
crippled in a sense.

For example, SVG
<https://en.wikipedia.org/wiki/Scalable_Vector_Graphics>is a
declarative language. It allows me to write:

<circle r="10px" cx="20px"  cy="20px" />

Here, I am just *declaring* that I need a circle of radius 10 pixels
centred at (20, 20). I don't care about the exact steps needed to draw it.
And there is no way to specify such details in the language.

Another example of a declarative language is SQL.

The opposite of a declarative language is an imperative language. So, if I
write a script which draws pixels one by one to form a circle, then it
would be an imperative approach.

The advantage of a declarative language is that it is easy to use. The
disadvantage is that it is not easy to extend.

A declarative language makes for a good "file format".

Now, a domain specific language (DSL) is one that deals with only a
specific domain; it is not general purpose. Again, SVG is an example of a
DSL. You can't compute the 4000th digit of Pi in it. It is again easy to
use a DSL, but hard to extend it.

Designing a declarative, DSL is a very hard thing to do. Somewhere we need
to draw a line that this is gonna be supported, other features are going to
be cumbersome and yet others are going to be impossible.

I think ledger overall does a great job of being a lean, declarative, DSL.
I don't want to deviate too much from the syntax and semantics of the
language, except where it helps make the syntax more regular.

cheers,
-- 
*Harshad RJ <http://lavadip.com>*

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to