Skip to content

Allow the use of colon in all custom operators #1446

@roboz0r

Description

@roboz0r

I propose we Allow the use of colon : in all custom operators.

Since the inclusion of dotnet/fsharp#15923 the : operator has been permitted only when the first non-ignored operator character is >.

I discovered this while working on updating the spec document resulting in this discussion. fsharp/fslang-spec#68

Pros and Cons

The advantages of making this adjustment to F# are it will simplify the lexing rules to allow : anywhere.

Currently the rules allow >: ?.>: or ><+-*/=~%.&|@^!?: but not <: or +:.

Existing uses of : specialized as keyword operators like : :?> :? :> :: := would be unaffected. A slight modification to this proposal would keep : as the first character of an operator reserved for type-related or other special operations in the compiler since that's what it tends to be used for today.

The disadvantages of making this adjustment to F# are operators containing : won't be able to be used for special purposes in the compiler in the future but there are no active plans to do this dotnet/fsharp#15923 (comment)

Extra information

Estimated cost (XS, S, M, L, XL, XXL): XS

Related suggestions: N/A

Affidavit (please submit!)

Please tick these items by placing a cross in the box:

  • This is not a question (e.g. like one you might ask on StackOverflow) and I have searched StackOverflow for discussions of this issue
  • This is a language change and not purely a tooling change (e.g. compiler bug, editor support, warning/error messages, new warning, non-breaking optimisation) belonging to the compiler and tooling repository
  • This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it
  • I have searched both open and closed suggestions on this site and believe this is not a duplicate

Please tick all that apply:

  • This is not a breaking change to the F# language design
  • I or my company would be willing to help implement and/or test this

For Readers

If you would like to see this issue implemented, please click the 👍 emoji on this issue. These counts are used to generally order the suggestions by engagement.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions