Hacker News new | ask | show | jobs
by gnud 2473 days ago
Well, I just took a cursory glance at the documentation. Ballerina looks like it would be perfect for a data processing pipeline we run, I thought I could try it out for prototyping a new processing step, and see how I liked it.

This first use-case I could think of involves XML processing. You have "native" xml types. Neat.

After reading the language spec, all the xml examples, and the documentation for the 'xml' and 'xmlutils' module, I have no idea how to read in a xml file and get an 'xml' value from it. I also don't know how to extract a record type from some XML, except by writing a manual mapper from the DOM node to the record.

The actual methods available on the 'xml' type seems kind of unfamiliar, even after working with XML in a lot of different languages. 'getName' and 'getElementName' seems to do the same thing for elements. For some reason. To determine the type of a node, you call 'getItemType'. But 'getItemType' does not document what happens with CDATA sections, document elements or document type elements. Why re-invent the wheel? what's wrong with getNodeName and getNodeType?

The 'slice' method is really weird. It expects numeric child indexes. I mean, you sometimes know the document order of the stuff you're working with, but that's not really XML-ish.

It looks like there's a lot of amazing work put into Ballerina, but I don't think I'll use it for this prototype.

1 comments

The XML design is going to get a significant refresh. The draft proposal is here: https://github.com/ballerina-platform/ballerina-spec/blob/ma....

The XML programming model is rather different from DOM and others for a lot of reasons. I hope reading this proposal will help.