• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Swift and parameter names
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swift and parameter names


  • Subject: Re: Swift and parameter names
  • From: Charles Srstka <email@hidden>
  • Date: Wed, 01 Jul 2015 20:15:43 -0500

On Jul 1, 2015, at 6:28 PM, Graham Cox <email@hidden> wrote:
>
> Obviously it’s only a convention, but I think horizontal values should always precede vertical ones, if only because x comes before y in the alphabet, and map coordinates are that way around as well. The change to {origin, size} was also very welcome, if only because moving a rect is now independent from sizing it, and doing either only changes two values, not four.

From a mathematical point of view (which the NeXT-derived frameworks clearly use), this is correct; the x-axis comes before the y-axis. However, from a more general/intuitive point of view, I think you can make a pretty good case for the vertical value coming first, given that in pretty much every situation in ordinary life, we tend to process the vertical value first. When reading text in Western languages, vertical position is more significant than horizontal, and when we’re dealing with tabular data or pretty much anything that’s in a grid-like arrangement, we always specify the row first, then the column.

This also explains why the classic Mac OS calculated vertical coordinates starting from the top instead of the bottom — that is, after all, how we read, and how we process most things that are spatially oriented; we start at the top. Of course, mathematical coordinates go up from the x-axis, so that’s the way the frameworks are set up.

Of course, in the end, it’s all convention, and it doesn’t really matter that much as long as you’re consistent (and that you have the named function parameters to make it clear what’s going on :-P).

Charles

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Swift and parameter names
      • From: Graham Cox <email@hidden>
References: 
 >Re: Swift and parameter names (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Swift and parameter names (From: Charles Srstka <email@hidden>)
 >Re: Swift and parameter names (From: Greg Parker <email@hidden>)
 >Re: Swift and parameter names (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Swift 2 throws from init()
  • Next by Date: Re: Swift 2 throws from init()
  • Previous by thread: Re: Swift and parameter names
  • Next by thread: Re: Swift and parameter names
  • Index(es):
    • Date
    • Thread