You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Swift Language
Hi all.
I'm facing this kind of expressions quite frequently:
if let unwrappedValue = someExpensiveOperation()where unrelatedCondition { ... }
This kind of if let expression always executes someExpensiveOperation before check the where clause. The obvious approach here is move the unrelatedCondition to an external if like:
if unrelatedCondition { if let unwrappedValue = someExpensiveOperation(){ ... } }
There is another way to write this?
Chris Lattner
unread,
Nov 20, 2015, 12:58:22 PM11/20/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Bruno Berisso, Swift Language
Hi Bruno,
You should be able to use:
if unrelatedCondition, let unwrappedValue = someExpensiveOperation() {
}
-Chris
Bruno Berisso
unread,
Nov 20, 2015, 2:58:03 PM11/20/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message