Re: Some non-obvious Swift goodies
Re: Some non-obvious Swift goodies
- Subject: Re: Some non-obvious Swift goodies
- From: Jens Alfke <email@hidden>
- Date: Thu, 05 Jun 2014 14:00:01 -0700
On Jun 5, 2014, at 1:41 PM, Ron Hunsinger < email@hidden> wrote: However it's implemented, it turned out to be an extremely powerful tool. I'm delighted to see its re-emergence.
Deferred evaluation does look extremely powerful, but I can imagine it’s also potentially very dangerous if misused, in that it can make the semantics of the calling code very non-obvious. Normally when I look at a function/method call, I know that the parameter expressions get evaluated first, before the function is called. With deferred evaluation that’s not true anymore, and in fact the _expression_ might be evaluated zero times or more than once. That could be really unexpected. People who create APIs (even internal APIs) will need to have the self-discipline to avoid making functions with counter-intuitive behavior.
(Ruby is a good example of what I’m worried about. It has so many clever syntactic tricks, that it can be nearly impossible to make head or tail of code that uses a Ruby library (like Rails) unless you already know the details of that library’s API.)
—Jens |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden