On Wednesday, 21 October 2015 at 19:18:44 UTC, Andrei Alexandrescu wrote:
On 10/21/2015 02:24 PM, Robert burner Schadek wrote:
On Wednesday, 21 October 2015 at 17:23:15 UTC, Andrei Alexandrescu wrote:
Even simpler, hasMethod!(Container, "append") -- Andrei

I know this goes against your talk at DConf, but having to write string parameters does not feel good. I'm will properly not be the only one who will mistype "apend" and wonder why the other template function will be chosen. I rather have the compiler scream at me telling me there is no
symbol hasApend. And hasAppend!Container is less typing than
hasMethod!(Container, "append").

Yah, but defining isXxx for dozens of Xxx doesn't sit well either. -- Andrei

So, instead we make it ad hoc where only the name is tested rather than anything about what the function is or does, and we make it that much harder for folks to know what the vocabulary list of functions is, because there's no list of traits to test for them and just a table in some piece of documentation somewhere? I just don't see this scaling well if we're not more rigorous about it than hasMethod!(Container, "append"). If all of the containers are in Phobos and nothing outside of Phobos is actually testing for any of these methods, then it's a much smaller issue, but if any of this method testing is going to happen outside of Phobos, then I definitely think that it's a bad idea to be this ad hoc about it.

- Jonathan M Davis

Reply via email to