On Monday, December 12, 2011 19:48:11 F i L wrote: > My biggest disappointment was(/is) with the lack of the alleged > Pseudo Methods (section 5.9.1). It's one thing to play around > with a language you understand is growing and under development. > It's another to boast about the language to your co-workers, only > to receive unexpected errors when they ask for demonstrations :/ > Bad for publicity, that.
I think that that section was not clear enough. Calling free functions as if they were member functions on a type works with arrays and has only ever worked with arrays. TDPL doesn't actually say that it works with anything other than arrays. It talks about adding them to built-in types and specifically talks about arrays, but it's not particularly clear about anything other than arrays. My guess is that it was never intended to mean anything other than arrays, but I don't know. Only Andrei would know that. There has been discussion of UFCS (universal function call syntax), which would then expand that beyond arrays to _all_ types - int, float, any user- defined type, etc. However, there are a number of issues with that (particularly with user-defined types; e.g. what if a member function and a free function have the same name?), and it has yet to be implemented. It may never be implemented. So, I think that there's a decent chance that you just misunderstood what that section in TDPL was really saying (it really should be clearer on whether it meant just arrays or all types), but there are definitely folks who want it to be extended to all types, so it may be eventually, but we'll have to wait and see. - Jonathan M Davis
