
Show HN: NCL – New Configuration Language - ezioamf
https://github.com/PayWithMyBank/ncl
======
avitzurel
From an initial look this looks very similar to Hashicorp hcl.

I'm not usually fond of "this is similar to..." type of comments but
considering its fully open source and solid, can you explain the main
differences and why you chose to develop your own?

All that being said, this seems very useful.

~~~
ezioamf
I found hashicorp hcl after starting to think about what we wanted internally
at PayWithMyBank.

The concepts are similar but we needed a language to change the composition
and configuration of our screens that had the same kind of flexibility as the
CSS language.

It is used as a replacement to XML/HTML to define visual components of the
page, having a better structure, and to easily change the screen to different
merchants, and to easily implement variations for A/B tests using CSS like
rules.

Ex:

B { value = "1"; }

Defines B as having value = "1".

A > B { value = "2"; }

Define B as having value = "2" if direct child of A.

So the definition:

C [ B, A [ B ] ]

The first B will have value = "1" and the second value = "2".

Each definition act as a template (like XSLT) to create the elements.

Also there is a main difference that element composition is separated from
element definition. So:

A { B { value = 4} }

Do not define the element A as having the element B. It define that if there
is an element B having a parent A the value will be 4.

The language do not hard define the elements but define how to create the
elements. You ask the language to create an specific element and all the rules
will be evaluated to return the desired element.

Edited: Clicked enter before finishing the message.

