Open jbenet opened 7 years ago
Hm, right now the configuration could easily be adapted to YML/JSON and in that way, be shared between different language implementations, which is very helpful in testing (but not limited to). Similar to how we do with protobufs across the different implementations. I think it would useful and also not too costly to agree on some convention with the configuration.
i would prefer go or js because it's computable. im not sure giving up the computation (yml and json) are a win-- it may yield much more complicated/complex and hard to read/write documents. BUT i think it's worth a shot, to see what it would look like. you may be totally right and it may be precisely what we want.
There is also option of some simple scripting language (Lua was created for complex configuration) or simple minimal LISP/Scheme variant (R7RS was aiming to minimize size of the interpreter).
Just seeing this now. I kinda like the idea, Would be cool to have this be a strict subset of javascript (making it easily parseable) that would allow us to easily specify a node construction.
This came into my radar today for the first time! Funnily, I implemented a DSL when I prototyped jvm-libp2p: https://github.com/libp2p/jvm-libp2p/blob/develop/src/test/kotlin/io/libp2p/core/HostTest.kt#L98. And it looks a lot like the one specified here 😀
For folks looking for the original example from js-libp2p/js-ipfs land, here is an updated pointer:
It got even more cleaner over the years :)
UPDATE Feb 2021, new location
@diasdavid showed me https://github.com/ipfs/js-libp2p-ipfs-nodejs/blob/master/src/index.js
I wonder if there is room for a DSL here (or using either js or go as the DSL) for specifying a libp2p node construction, which then can have a compiler/transpiler to the libp2p language of choice.
Example
take something like this (this is obviously wrong, and though it's go-ish, it does not adhere to any language, just a toy example)
And the above could be compiled to relevant Go code and JS code.
More trouble than it's worth
After sleeping over it, this seems like more trouble than it's worth, but i'll log this idea just in case.