On Wednesday, 30 August 2017 at 15:59:32 UTC, Jean-Louis Leroy wrote:
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 https://github.com/jll63/openmethods.d/blob/1.0.0-rc.1/examples/matrix/source/matrix.d#L12).

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

import openmethods;
mixin(registerMethods);

void main()
{
}

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.
  • Re: Open Methods: From C++ ... Mark via Digitalmars-d-announce
    • Re: Open Methods: From... Jean-Louis Leroy via Digitalmars-d-announce
      • Re: Open Methods: ... Arun Chandrasekaran via Digitalmars-d-announce
        • Re: Open Metho... Jean-Louis Leroy via Digitalmars-d-announce
          • Re: Open M... Arun Chandrasekaran via Digitalmars-d-announce
            • Re: O... Jean-Louis Leroy via Digitalmars-d-announce
              • R... rikki cattermole via Digitalmars-d-announce
              • R... Jean-Louis Leroy via Digitalmars-d-announce
              • R... jmh530 via Digitalmars-d-announce
              • R... Jean-Louis Leroy via Digitalmars-d-announce
              • R... jmh530 via Digitalmars-d-announce
              • R... Jean-Louis Leroy via Digitalmars-d-announce
              • R... Jean-Louis Leroy via Digitalmars-d-announce
              • R... jmh530 via Digitalmars-d-announce
              • R... EntangledQuanta via Digitalmars-d-announce
              • R... Jean-Louis Leroy via Digitalmars-d-announce
              • R... EntangledQuanta via Digitalmars-d-announce
              • R... Jean-Louis Leroy via Digitalmars-d-announce
              • R... EntangledQuanta via Digitalmars-d-announce
              • R... Jean-Louis Leroy via Digitalmars-d-announce
              • R... EntangledQuanta via Digitalmars-d-announce

Reply via email to