www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2343] New: unified function call syntax

reply d-bugmail puremagic.com writes:

           Summary: unified function call syntax
           Product: D
           Version: 1.035
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: benoit tionex.de

If a global function exists like this:

bool equals(char[] a, char[] b){
  return a == b;

It is possible to use it like this:
char[] str1 = ...;
char[] str2 = ...;

str1.equals( str2 ); // compiles OK

But if this is used from within a class that also has a method with the
name "equals" the syntax above does not work any more:

class A {
  bool equals( Object o ){ ... }
  void foo (){
    bool res = str1.equals(str2); // compile error
      // equals(Object) does not
      // match parameter types (char[],char[])

    bool res2 = .equals(str1,str2); // compile OK

The compile error should not happen, because in case of str1.equals(.. only the
methods of type(str1) and global functions should be looked at.

Sep 07 2008
next sibling parent d-bugmail puremagic.com writes:

brunodomedeiros+bugz gmail.com changed:

           What    |Removed                     |Added
                 CC|                            |brunodomedeiros+bugz gmail.c
                   |                            |om

------- Comment #1 from brunodomedeiros+bugz gmail.com  2008-09-22 07:47 -------
To fix this, it would be necessary to make the "external member functions" a
proper feature, instead of the simple hack/accidental-feature it is now. Among
other things, it should work for other types and not just arrays, have a way to
prevent normal external functions to *not* be considered as member functions,

Sep 22 2008
prev sibling parent d-bugmail puremagic.com writes:

Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #2 from Don <clugdbug yahoo.com.au> 2012-11-19 07:20:24 PST ---
..And indeed UFCS was implemented!

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 19 2012