Skip to content

proposal: Go 2: Allow question marks in function names #26111

@sblackstone

Description

@sblackstone

This comes from Ruby and its a real readability helper for functions that simply return booleans, e.g.

type OptionContract struct {
  Right string
}

func (oc *OptionContract) put?() bool {
  return oc.Right == 'P'
}

var (
  oc OptionContract
)

oc.right = 'P'

oc.put?() // True

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions