On Mon, 03 Sep 2012 21:04:56 +0100, Era Scarecrow <[email protected]> wrote:

On Monday, 3 September 2012 at 18:45:42 UTC, Jonathan M Davis wrote:
However, one thing to remember that complicates this a bit is that it's perfectly possible to declare a function which is overloaded with one function taking a pointer and one not.

void func(S* s, int i) {...}
void func(S s, int i) {...}

in which case, there's an ambiguity, and I would then expect UFCS to _not_ compile when using S*, or you'd risk function call hijacking. That's not necessarily a big deal, but it _does_ complicate things a bit.

- Jonathan M Davis

I think moreso is would if it would convert to ref automatically or not rather than worry about pointers. True if you wanted all three, then the language has to keep them all distinctly different; But if it silently converts it should be okay (so long as constness/immutable is honored). Assuming that's the case:

   //these two effectively identical
   void func(S* s, int i) {...}
   void func(ref S s, int i) {...}

What if the first function is in library A and the 2nd function in library B and they do two totally different things?

R

--
Using Opera's revolutionary email client: http://www.opera.com/mail/

Reply via email to