Re: free function on arrays & language operations

2010-12-07 Thread Jonathan M Davis
On Tuesday, December 07, 2010 10:10:31 spir wrote: > Hello again, > > I started to be found of defining types which basically are arrays with > free functions, instead of creating a struct or class with methods. Not > only we still have pseudo-method syntax (for arrays only), but this allows > cus

Re: free function on arrays & language operations

2010-12-07 Thread bearophile
spir: > But: is there a way to define functions corresponding to language operations > (opEquals, opIndex, toString...) without creating a true type? You may find some trick to do something like that, but it's not how D is supposed to be used. In D operators belong in a struct/class/enum. "alia