Skip to content

{+flag}, {-flag} as shorthand for {flag: true}, {flag: false} #885

@TrevorBurnham

Description

@TrevorBurnham

It's great that {foo} is shorthand for {foo: foo}, because that's a common (and awkward) construction; {option: true} and {option: false} are also very common, and a series of options could be made much more readable by introducing a shorthand. For instance, instead of

options = {invert: true, buffer: false, copy: true, thumbnail: false, zoom: true}

you could write

options = {+invert, -buffer, +copy, -thumbnail, +zoom}

I see this as a significant improvement in readability—it's much easier to check whether a particular option is enabled or disabled— as well as sheer succinctness.

Note that I'm proposing that this syntax only work inside of explicit curly braces, just as the {foo: foo} shorthand should only work that way (currently, no one has figured out how to implement this desired behavior).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions