Plot
Plot copied to clipboard
Public API incomplete - test case provided
Hi John, Hi Contributors,
great framework. Thanks a lot.
I intend to create a DSL for SVG, to be used in my software (Vithanco). I don't think that we want to have all new DSLs to be part of the Plot code itself. So, I am creating a separate plotSVG library which is using and extending Plot.
However, it looks like that the Public API is incomplete (clearly, my understanding is still growing). The public API doesn't seem to allow me to create the root element The inbuilt DSLs are using an internal API, based on the internal data type AnyNode
, by instantiating the struct Element
directly. For the public API the static func named
is available, but for some odd reason Node<Context>
cannot be converted to Node<Any>
(See as well: https://stackoverflow.com/questions/60876187/how-to-convert-from-nodexxx-to-nodeany).
I am not yet ready to create a solution myself, but I believe that I could capture the problem in a few lines of code that are now part of the test case that is part of this pull request. I hope it makes sense.
Cheers, Klaus
Test fails - the public API is incomplete therefore the tests have to fail.
I suggest to change the Element function to
static func named<C>(_ name: String, nodes: [Node<C>]) -> Element { Element(name: name, nodes: nodes) }
However, it breaks some formatting test cases.