(due to the limited editing capabilities of Blogger.com, I have to post the examples at CandleScript.net)
From the examples, you can see that Candle Markup has a very expressive
syntax and flexible data model, with which you can easily invent your
own pseudo DSLs to suit your application and still enjoy all
the benefits of a general markup format. Just to reiterate the
advantages of a general markup format over a domain-specific format:
- easier-to-learn: your application user do not have to learn all kinds of abstract domain-specific syntaxes;
- easier-to-use: you'll be able to leverage the tools that supports advanced editing, validation, refactoring on the general markup format;
- easier-to-process: you'll be able to use advanced scripting features, like schema, path selection, query, transformation and CRUD update on the general format;
x
"=" +{ "-"b "+-" sqrt{b sup 2 "-" 4 a c}} over _{2 a}
might be very readable but can be hard to process with flat lists of
nodes. A more structured representation could be:math { in { i{x} divide { plus-minus { minus { i{b} } root { minus { power { i{b} 2 } times { 4 i{a} i{c} } } } } times { 2 i{a} } } } }No matter you prefer a terse format or a structured format, the power is now in your hand. Candle supports both equally well, and can easily transform one into the other.
You seem to be doing some incredible work here.
ReplyDeleteI'm curious, there seems to be no organisation or institution behind you, is that correct?
You also need adoption. Do you have a sense of how or who in this regard?
To be very frankly, YES, currently there's no organisation or institution behind Candle. It's very much my personal effort.
ReplyDeleteBut the biggest institution Internet, and the biggest organization OSS is behind me. :-)
Yes, I agree that moving forward, Candle needs some kind of endorsement by some standards body. IEFT RFC is one option.
How would Candle fit as an alternative for the current syntactic XML support in Scala? Could you show what it would look like?
ReplyDeleteBelow is a simple XML sample that I take from some Scala tutorial:
ReplyDeletedef makeXML(id: String) = <span id={id}><strong>Hello,</strong> World!</span>
When converted into Candle Markup, it would look like:
def makeXML(id: String) = <span id={id}><strong>"Hello,"</strong> "World!" </span>
Generally, for Scale to support Candle Markup, it has to be enhanced to support parsing Candle's syntax. It'll also need to introduce some option for user to specify whether the embedded markup is in XML syntax or in Candle syntax.
Projects like (http://anti-xml.org/) shows how scala.xml package can be replaced. To support Candle Markup in Scala. A similar package needs to be developed.
ReplyDeleteHenry, the Cancle Markup that you present for Scala disappoints me. It is basically the same as the old XML, including the repetition of the tag names at the closing tags.
ReplyDeleteLet's make the Hello World XML sample slightly more complicated: the "ll" should be italic. The Scala version would then be
<span id={id}><strong>He<italic>ll</italic>o,</strong> World!</span>
I would hope a Lua version would be something like
<span { id = {id} strong {"Hello" italic {"ll"}"o, "} "World!" }>
What do you think?
You example in Candle element notation:
ReplyDelete<span id={id}><strong>"He"<italic>"ll"</italic>"o,"</strong>" World!"</span>
Yes, it is very close to XML except that string are quoted.
In Candle object notation:
span {id={id} strong{"He" italic{"ll"} "o,"} " World!"}
Very close to your Lua version.
The element notation can be easily embedded in Scala. The object notation probably requires more change to Scala language.
Another hybrid way might be as you used in your Lua example. Keep the outer most node in element notation, it serves as the delimiter to separate the markup from normal Scala script. Inside the element, object notation can be used for its terseness.
Excuse me; I wrote Lua when I meant Candle. And I made a mistake in the "Hello" part.
ReplyDeleteAnyway, I really like the Candle Object Notation; I would prefer it much above the embedded XML in Scala.
Maybe you should keep the outer "<" and ">" brackets so that the Scala compiler can easily parse it.
I'm glad we have consensus now. :-)
ReplyDelete