Skip to content

Equal Followed by +/- Directly Bugged #171

@montymxb

Description

@montymxb

Writing this expressions does not work:

f2: Int
f2 =-1

With a parse error of:

unexpected '-'
expecting end of "="

This is the same for a leading +. This holds for let exprs, function equations, and any other cases where an = can be followed by a symbol instead of an alpha-numeric character.

This isn't the worst of errors, as the line number associated is correct, but the message is vague. In addition it may be counter intuitive, as let x=5 is valid, but let x=-5 is not. This was brought up in today's (Nov. 20th) Friday meeting, and a couple of options were mentioned.

  • These should be valid expressions (Jennifer)
  • It should be enforced as a parse error, where = must always be followed by a space and with a better message (Martin)

Some caveats that I would like to add:

  • Syntax highlighting currently changes when =- is combined. This may be a confusing factor if we make this a valid expression.
  • Enforcing the space is likely to break existing programs that do not include a space after =.

Either way, it appears this is something we will consider post-Fall term.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs detailsMore information to proceed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions