• 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] best way to support 'keyword' args, symbolic values, show values as literals?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?


  • Subject: Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
  • From: has <email@hidden>
  • Date: Tue, 16 Jun 2015 16:09:30 +0100

On 15/06/2015 18:39, Quincey Morris wrote:
On Jun 15, 2015, at 10:17 , has <email@hidden <mailto:email@hidden>> wrote:

the goal is to enable a user to print an object specifier and be able to copy-and-paste that straight into another script - i.e. `-description` should always return a string that represents valid Swift code

I dunno about #1 or #2, but for #3 look into the “Custom…” family of protocols, especially ‘CustomStringConvertible’, which is the one that defines ‘description’ and ‘debugDescription’ as having more-or-less their Obj-C meanings. IIRC, CustomStringConvertible is also the one that allows your custom type to participate in string interpolation: “\(variableOfYourType)”, which would connect you with what I assume you mean by “printing".

The standard protocols are all documented in the Swift Standard Library document for Swift 2. It’s worth browsing the list to see if there’s other stuff that might be helpful. Any of the “…Convertible” protocols might open up possibilities for streamlining your invocation syntaxes.

Will give it a crack, thanks. (Just discovered the amazing answer to #1, so am off to play with that first.;)

has
_______________________________________________

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


References: 
 >[Swift] best way to support 'keyword' args, symbolic values, show values as literals? (From: has <email@hidden>)
 >Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals? (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Most People Still Use Dialup
  • Next by Date: Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
  • Previous by thread: Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
  • Next by thread: Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
  • Index(es):
    • Date
    • Thread