We were discussing this on the IRC, and me and sorta @kiljacken both agree that they could be really convenient. For instance in the string library, to compare a string the code is:
func compare(a: string, b: string) -> bool;
Which is used as follows:
This is okay, but it would be much cleaner to allow for having methods on primitive types for cleaner, flexible code:
func (a: string) compare(b: string) -> bool;
Which is used as:
There are some obvious flaws, most of which are relevant to the module system. Another thing I could picture being quite... strange is the following would technically be valid:
Though we could disallow this behaviour with literals? I'm not sure about any other flaws, but if this feature is useful, then perhaps we could discuss either why it should not be implemented, or perhaps how we would resolve these flaws (without making huge changes to the compiler or language).