Loading ...
Sorry, an error occurred while loading the content.

66595Re: [XP] Ruby vs Perl [Was: help with TDD]

Expand Messages
  • Chris Hanson
    Nov 30, 2002
      At 8:23 PM +0100 11/28/02, cg@... wrote:
      >And someone thought that
      >Smalltalk has a weird syntax, well: speak for yourself, please ;-). It
      >may be different, but IMNSHO the differences are a great advantage,
      >especially the way in which a method name is interwoven with its arguments
      >in order to give an end result quite close to plain English - it makes
      >for extremely readable code)

      This is Alan Cox borrowed the messaging syntax in his Objective-C
      additions to C -- used by the NeXT-derived Cocoa frameworks in Mac OS
      X.

      Your Smalltalk example,

      someButton on: #mouseDown do: [self closeWindow]

      would be slightly different in Cocoa, since Objective-C doesn't have
      blocks (closures). (Yet...) Instead it would be:

      [someButton setTarget:self];
      [someButton setAction:@selector(closeWindow:)];

      (Objective-C uses the brackets to distinguish a message expression
      from a regular C expression.)

      Of course, these would actually be set in Interface Builder by
      drawing a line from the button to the target, and selecting the
      action to send from a list. But the lines just cause the
      interface-loading code to send -setTarget: and -setAction: to the
      button.

      -- Chris

      --
      Chris Hanson | Email: cmh@...
      bDistributed.com, Inc. | Phone: +1-847-372-3955
      Making Business Distributed | Fax: +1-847-589-3738
      http://bdistributed.com/ | Personal Email: cmh@...
    • Show all 11 messages in this topic