zaphar / ucg

A Universal Configuration Grammar
Apache License 2.0
36 stars 3 forks source link

Question: Is UCG influenced by Jsonnet? #17

Closed nikolay closed 5 years ago

zaphar commented 5 years ago

I was actually not familiar with jsonnet till I saw this question so in that sense no. However it does appear to have similar goals and motivations.

nikolay commented 5 years ago

@zaphar One of the biggest things in Jsonnet is the lazy evaluation. After having worked with Jsonnet for years, I'd say it's both a curse and a blessing. After I pointed out your project to the lead of Jsonnet, this is what the feedback was:

they're using self to mean super it doesn't have the laziness or the late binding so it won't be as expressive select could be done with a function in jsonnet I think this out json foo thing is also true about bazel you end up with statements that append to the output essentially, rather than expressions that evaluate to the output which is fine, but you can get in a situation where you don't know where your output is coming from (edited) jsonnet also supports all the same output formats as that, except TOML which would be trivial to add if anyone really needed it

the select conditionals look handy I don't get why they made import a separate statement (import "foo.ucg" as foo;) instead of just using let foo = import "foo.ucg"; it also seems odd that out json foo causes it to write to a file instead of printing json to stdout overall it looks like a fairly reasonable language; seems fairly comparable to jsonnet and nix, aside from lacking real functions

zaphar commented 5 years ago

Good feedback, thanks for passing it on.

Self is actually only valid in the context of a tuple so it's not exactly super. I specifically left out the laziness since I wasn't sure it would be of any use.

I have actually been thinking about making import an expression as well so the let foo = import "foo.ucg" syntax may yet happen.