Skip to content

struct/enum fields names #1745

@sdancer

Description

@sdancer

can't mix underscores or other symbols to names, how to define a large protocol ?

imagine a few hundreds of these used on real code to implement a network protocol:

pub type OptionType {
  OptionTypeFoo
  OptionTypeBar
  OptionTypeBaz
}
pub type ExampleResponseOrError {
  ExampleResponseOrErrorResponse(response: option.Option(Response))
  ExampleResponseOrErrorError(error: String)
}

in other langs, u at least can use some symbols on the names

pub type OptionType {
  OptionType_Foo
  OptionType_Bar
  OptionType_Baz
}

in rust u have multiple alternatives to avoid name clashes, and reduce visual clutter or at least hint where a name ends and another stars

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