On Wednesday, 30 August 2017 at 15:59:32 UTC, Jean-Louis Leroy
What happens here is that kick(Animal) is shadowed by
kick(Dog). kick(Animal) is a method but it appears to the user
and the compiler as an ordinary function - which is generally
good. As such it is eligible for UFCS. I would not recommend
this sort of coding, but it's everyone's choice, methods or not.
Likewise, methods can be overloaded (like here
A current limitation is that default arguments are not
supported (yet), although I think it's just a matter of putting
the effort in.
UFCS interacts nicely with methods because you can say
a.plus(b) even if 'plus' is an open method.
I can submit this as an issue on the github page, but I figured
I'd mention it here in case there was some easy fix.
I tried installing the latest release from github. Compiling
(Windows 7 on DMD with default options) the simple program below
gives me the errors:
..\..\dubFolder\openmethods.d-1.0.0-rc.1\source\openmethods.d(970,21): Error: ca
nnot implicitly convert expression h of type ulong to uint
..\..\dubFolder\openmethods.d-1.0.0-rc.1\source\openmethods.d(1076,34): Error: c
annot implicitly convert expression dim of type ulong to uint
..\..\dubFolder\openmethods.d-1.0.0-rc.1\source\openmethods.d(1177,23): Error: c
annot implicitly convert expression h of type ulong to uint
dmd failed with exit code 1.
The error at line 1076 can be fixed by changing the type of dim
in the function to size_t. I couldn't fix the other errors. I
tried having the hash function return size_t also, but that just
causes other problems.