proposal: spec: operator functions
The only issue that I could _find_ about operator overloading currently #19770, although it's currently closed and doesn't have many details. # Goal Operator overloading should be used to create datatypes that represent things that already exist in Go. They should not represent anything else, and should ideally have no other function. **New operators should not be allowed to defined**, we should only be able to define currently existing operators. If you look at languages that let you define your own operators (Scala, looking at you!) the code becomes extremely messy and hard to read. It almost _requires_ an IDE because operator overloading is very heavily used. **Using an operator for anything _other_ than it's purpose is a bad idea**. We should not be making data structures with fancy looking `+` operators to add things to the structure. Overloading the `+` operator in Go should _only_ be used for defining addition/concatenation operators for non-builtin types. Also, as per Go spec, binary operators should _only_ be used for operating on two values of the same type. **Operators should only operate on and return a single type**. This keeps things consistent with how operators currently work in Go. We shouldn't allow any `type1 + string -> type1` stuff. **Operators should only be defined in the same package as the type they are defined on**. Same rule as methods. You can't define methods for structs outside your package, and you shouldn't be able to do this with operat
Posted by deanveloper on Sep 10, 2018, 9:53 PM
Tags
Related issues
- To be fair, Inform7 can't succeed, generally, because there is no market for the kind of games that you create with Inform7.
- > The notion that somehow LR reliability is misunderstood by Consumer Reports, JD Power, Car & Driver, Automobile etc.
- Custom trigger IDs are not displayed in the new 2026.10 trigger selector
- I hate that too, but I think it’s more the ux than the concept of a default.
- > The biggest problem with UX developers is they know better than you AND force you into their paradigm.
- "Focus follows mouse" is what I use to keep the file manager from popping up when click-dragging files.
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
ux (Other)
To be fair, Inform7 can't succeed, generally, because there is no market for the kind of games that you create with Inform7.
> The notion that somehow LR reliability is misunderstood by Consumer Reports, JD Power, Car & Driver, Automobile etc.
Custom trigger IDs are not displayed in the new 2026.10 trigger selector
I hate that too, but I think it’s more the ux than the concept of a default.
> The biggest problem with UX developers is they know better than you AND force you into their paradigm.
"Focus follows mouse" is what I use to keep the file manager from popping up when click-dragging files.
The biggest problem with this is if the target URL doesn't load but also doesn't quickly error out, like e.g.
Google wants to build up a private web here.
proposal: spec: operator functions
The only issue that I could _find_ about operator overloading currently #19770, although it's currently closed and doesn't have many details. # Goal Operator overloading should be used to create datatypes that represent things that already exist in Go. They should not represent anything else, and should ideally have no other function. **New operators should not be allowed to defined**, we should only be able to define currently existing operators. If you look at languages that let you define your own operators (Scala, looking at you!) the code becomes extremely messy and hard to read. It almost _requires_ an IDE because operator overloading is very heavily used. **Using an operator for anything _other_ than it's purpose is a bad idea**. We should not be making data structures with fancy looking `+` operators to add things to the structure. Overloading the `+` operator in Go should _only_ be used for defining addition/concatenation operators for non-builtin types. Also, as per Go spec, binary operators should _only_ be used for operating on two values of the same type. **Operators should only operate on and return a single type**. This keeps things consistent with how operators currently work in Go. We shouldn't allow any `type1 + string -> type1` stuff. **Operators should only be defined in the same package as the type they are defined on**. Same rule as methods. You can't define methods for structs outside your package, and you shouldn't be able to do this with operat
Comments (0)
No comments yet. Start the discussion.