Skip to content

Choose one ternary syntax: braced vs prefix #119

@danieljohnmorris

Description

@danieljohnmorris

Problem

We currently have two ternary syntaxes that do the same thing:

=x 0{10}{20}     -- braced ternary (original)
?=x 0 10 20      -- prefix ternary (new in v0.9.1)

Both are 5 tokens. Having two ways to do the same thing violates ilo's core principle of minimal surface area — one way to do each thing.

Options

Keep braced, drop prefix

  • =x 0{10}{20} is consistent with guards (braces = body)
  • Already established, documented, used in examples
  • Braces visually delimit the two branches
  • No ? overloading (already used for match)

Keep prefix, drop braced

  • ?=x 0 10 20 is more consistent with prefix notation style
  • No braces needed
  • But ? is already overloaded (match expressions)
  • ?= can look like assignment at a glance

Decision needed

Pick one and remove the other from the parser, SPEC, and docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions