8 ms·
Except .... (...No one asked, but here are my $0.02 ;-) You need typescript in your environment to use typescript! The four formats the OP listed can be read
by SavantIdiot 5y ago
Except ....
(...No one asked, but here are my $0.02 ;-)
You need typescript in your environment to use typescript!
The four formats the OP listed can be read by anything from Ada to EXCEL. But typescript can only be ready by a TS build flow.
In fact, I think JSON was a bridge too far. A config file shouldn't need a compiler.[1]
FOR GENERAL PURPOSE: big no.
BUT: If this is purely for TS projects where the tooling already exists, then OK. I'd use it.
EDIT [1] I'm referring to the article's early suggestion to run JSON through JSMin to support comments. So transpiling is more apt, not compiling.
- __ryan__ 5y ago> In fact, I think JSON was a bridge too far. A config file shouldn't need a compiler. Does JSON need a compiler?
- a_lost_needle 5y agoIt does not. Easily implemented with combinators the whole way down.
- SavantIdiot 5y agoCorrect, but the very beginning of the original article proposes running JSON through JSMin to support comments. So in this context, a "compiler" is being proposed (or transpiler to more modern). My comment isn't clear.
- a_lost_needle 5y agoStill easily implemented with combinators the whole way down. It’s building an ast, that’s it. Once you have a tree, you can do whatever you want with the result before passing it to a compiler for a language. Here though, just serialization stuff.
- SavantIdiot 5y agoLike grandma used to say: "There's nothing combinators can't solve. Except consumption. Rest in peace Grandpa Neddie." I'm dense: what's a combinator?
- a_lost_needle 5y agoA functional programming technique that allow you to declaratively define your language when using parsers as values. If you have a good functional language implementation, the code look very similar to someone able to read BNF. And then you run it, and get out an AST the back end. edit: Forgot partial application. Not strictly required, but super handy.
- SavantIdiot 5y agoAh, I see. I can't reply to that thread anymore, but it sounds like a combinator is like a first-class YACC grammar in the functional language that obviates the need to write the parser. That's really cool, thanks. I'll read up on it more.
- a_lost_needle 5y agoYea, that’s pretty accurate. So now I’m curious what you thought the site was named after? Edit: It’s not that accurate. It’s just math used in a way to compose parsers using parsers.
- SavantIdiot 5y agoNever gave it a moment's thought. Now after Googling it, I still wouldn't know because I don't program LISP (well I haven't since 1986, but that was only an intro in college). Interesting to read about it.
- a_lost_needle 5y agoYou can use most of the concepts in any language that allows first class functions, closures, pattern matching and types. Combinators are just ways to compose a function to create a new function that executes some aspect upon a set (usually).
- Zababa 5y agoThat's one proposed solution but not the only one. You could just ignore comments, like most programming languages do.
- deleted 5y ago[deleted]
- Zababa 5y ago> In fact, I think JSON was a bridge too far. A config file shouldn't need a compiler. JSON just needs a parser, like most other configuration formats. It's purely declarative.