Skip to content

New data types: "plain" binary, tagged binary - #52

Merged
michaelklishin merged 1 commit into
mainfrom
mk-tagged-binary-type
Aug 6, 2024
Merged

michaelklishin merged 1 commit into
mainfrom
mk-tagged-binary-type

Conversation

@michaelklishin

Copy link
Copy Markdown
Collaborator

Similar to string and tagged string (#46), respectively.

Similar to string and tagged string, respectively.
@michaelklishin michaelklishin added this to the 3.4.0 milestone Aug 6, 2024
@michaelklishin
michaelklishin merged commit 8f1926c into main Aug 6, 2024
@michaelklishin
michaelklishin deleted the mk-tagged-binary-type branch August 6, 2024 20:18
michaelklishin added a commit that referenced this pull request Oct 20, 2026
In #46 [1] we introduced a way to
tag a value with a prefix, and in #52 [2], a few more types that use that machinery.

That works well for a lot of cases.
However, tagged values also have
a limitation: a colon is used to
separate the tag from the value.

Some values, namely URLs and URIs,
are guaranteed to have a colon.

Therefore we need a new data type
that would fix the prefix and make it
trivial for the parser to not
mistake `http` or `amqp` or `urn`
schemes for a tag.

I have considered several alternatives
on top of prefixed strings and they
all ended up being much more complex
than this convention-based specialization
of the generic tagged value idea.

Some examples from the `REFERENCE.md` file:

```erlang
{datatype, [encrypted_binary, binary]}
{datatype, [encrypted_string, {uri, [https]}]}
```

```ini
default_pass = encrypted:ec3Z4yFBjnzh+7VeDZ+tRoB7LFI2ZnU8H8eyIingNwV8d1q/DQ/cF4rnZXzwgszlLd0ZkEz5WaMZoNa8n50dqA==
trust_store.url = https://ca.example.com/certs
```

1. #46
2. #52
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.

1 participant