8000 Idea: number suffixes as annotations · Issue #510 · kdl-org/kdl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Idea: number suffixes as annotations #510
@zkat

Description

@zkat

There was a discussion over at YaLTeR/niri#1142 (comment) when trying to come up with enhancements to Niri's DSL regarding numerical stuff. The tl;dr is that there's interest in being able to type things like 100px and 50%, and not having to quote it.

I thought about this a bit, and I would like to propose the following change to the number grammar to facilitate this. This change would be forward compatible: existing v2 parsers would error (instead of returning incorrect data).

The change is as follows:

  1. any valid number may be suffixed, with no spaces, by a string (of any kind, but most likely an unquoted string). If this is done, the suffix will be used as the type annotation for that number value. That is, 100px would be equivalent to (px)100.
  2. If you have BOTH a parenthetical annotation, AND a suffix, it will be treated as a syntax error. You simply cannot do (px)100%

One catch: a very narrow range of invalid v2 documents will now become valid (since foo 100px will no longer be an error)

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0