Skip to content

Conversation

@BlazingTwist
Copy link
Contributor

For the record, where do you draw the line between features that should be extra packages instead of merged into the standard library?


This adds instructions for reading and writing XML, supporting whitespace and meta nodes.
I've been using this for basic XML processing, where an XSLT transformer would be excessive.

xml.dumps example:

> :{"foo":name; [:{"bar":name;}]:content;} :(xml.dumps)
"<foo><bar/></foo>"

xml.loads example:

> "<list><item>1</item><item>2</item></list>" :(xml.loads)
:{
  0:meta;
  "list":name;
  [ ]:attributes;
  [
    :{
      0:meta;
      "item":name;
      [ ]:attributes;
      [ "1" ]:content;
    }
    :{
      0:meta;
      "item":name;
      [ ]:attributes;
      [ "2" ]:content;
    }
  ]:content;
}

It's a bit clunky to use / I had to fight the standard library to get this to work.
But it's better than Regex.

@BlazingTwist
Copy link
Contributor Author

I'd like to make this a bit more robust for rewriting existing Xml. (Mainly preserving whitespace between attributes and better support for entity references (e.g. &nbsp;))

Though I cannot use the builtin parsers / serializers for this, so it'll be a bit of a rewrite.

@BlazingTwist BlazingTwist marked this pull request as draft May 11, 2025 07:41
@nick-paul
Copy link
Collaborator

This is great, thanks for putting it together.

For the record, where do you draw the line between features that should be extra packages instead of merged into the standard library?

I don't have a formal definition at this point. Practically speaking, it is nice to have some of the more common tools easily accessible in the language and I'm not too worried about limiting the :(...) style operators at this point. So, if it is in the standard library of languages with big standard libraries like Python or Ruby, then I think it is fine to keep in the standard library here.

@BlazingTwist
Copy link
Contributor Author

BlazingTwist commented Nov 19, 2025

Disable truncating in important strings (106b604 and 348006b)

Disables truncating in

  • lists (relevant for import errors, which prints a list of candidate files)
  • assert errors

Publish a runtime artifact (3de2229)

This contains files required for running aya. (ayarc.aya, base/*.aya and std/*.aya)

That way, package developers can run 'pkg.test' in their build process.
(Unfortunately this doesn't quite work yet, since aya is not available in any public maven repository)
(The current workaround/hack is to build aya from source, like this)

Redesign the Xml instructions to be easier to use (3301811)

With the old instructions, I tried to push too many usecases onto a single instruction.

The new instructions focus on extracting/writing data with as little friction as possible.
They're heavily inspired by this python package https://pypi.org/project/xmltodict/

This package https://github.com/BlazingTwist/xml.aya (WIP) will cover more advanced usages, such as modifying existing documents, extracting data with xPath expressions, reading data from comments/processing-instructions, or validating against an XSD.

@BlazingTwist BlazingTwist marked this pull request as ready for review November 19, 2025 14:25
@nick-paul nick-paul merged commit 6afe927 into aya-lang:master Dec 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants