http://d.puremagic.com/issues/show_bug.cgi?id=5749

           Summary: argument evaluation order of chained function from
                    right
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: fa...@gmx.ch


--- Comment #0 from Fawzi Mohamed <fa...@gmx.ch> 2011-03-18 12:27:28 PDT ---
I was surprised by the avaluation order of opCall arguments:

    extern(C) int printf(/+const +/char*,...);

    struct A{
      A opCall(int i){
        printf("i=%d\n".ptr,i);
        //return this;
        return *this;
      }
    }

    void main(){
      A a;
      size_t  i;
      a(++i)(++i);
    }


prints

i=2
i=1

because the arguments are evaluated from right.
I found it vers surprising, I would have expected to have them evaluated from
left to right.
This "breaks" whisper style chaining.
I am not sure if/when this behaviour is documented/useful, but I would change
it

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

Reply via email to