[Gd-hackers] Slot syntax vs. function call syntax (was Re: gtk interface: shorten identifiers, ... ?)

Chris Page chris at chris-page.org
Tue Dec 5 12:57:10 CET 2006


On Dec 3, 2006, at 16:40 PM, Bruce Hoult wrote:

> On 12/4/06, Chris Page <chris at chris-page.org> wrote:
>> As it happens, I'd rather lose this feature of Dylan and make it  
>> so that window.foo(1, 2, 3) is equivalent to foo(window, 1, 2, 3),  
>> which I think would be much more useful and widely applicable (no  
>> pun intended).
>
> I guess you could still write (window.foo)(1,2,3) if that's what  
> you wanted.

Though, given the current Dylan language I might expect that to  
evaluate identically to window.foo(1,2,3) -- I'm not sure whether the  
additional parenthesis change the evaluation at all in this case.  
Instead, I think you'd write either of

   foo(window)(1, 2, 3)
   window.foo()(1, 2, 3)

> That would be ok, as long as window.foo still meant foo(window).  
> Which isn't terribly consistent, syntactically, as window.foo()  
> would mean the same thing.  But I've seen worse.

I can easily see it making sense if we view it starting from the  
general function call syntax:

     foo(window, 1, 2, 3)

   can also be written

     window.foo(1, 2, 3)

   and

     foo(window)

   can also be written

     window.foo()

   in which case you can omit the redundant parenthesis

     window.foo

Just a progression from the more general syntax to the more specific.

-- 
Chris Page - Software Wrangler

  That’s “Chris” with a silent *and* invisible “3”.





More information about the hackers mailing list