[swift-evolution] Required Callback

James Campbell james at supmenow.com
Wed Aug 17 09:05:41 CDT 2016


In this case the @required callback is something *all* implementations
should use for the mentioned reasons (memory leaks etc) just to clarify :).

*___________________________________*

*James⎥Lead Hustler*

*james at supmenow.com <james at supmenow.com>⎥supmenow.com <http://supmenow.com>*

*Sup*

*Runway East *

*10 Finsbury Square*

*London*

* EC2A 1AF *

On 17 August 2016 at 11:31, Haravikk <swift-evolution at haravikk.me> wrote:

>
> > On 17 Aug 2016, at 02:49, Boris Wang via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> > Why the callback is special ?
> >
> > The compiler should has a warning for unused parameters of function.
> >
> > I think this is enough. More works should be leaved for a lint tool.
>
> Actually I think that that kind of warning should be left for linters as
> well; a protocol might define parameters that not all implementations use,
> or a type may define a method with a parameter that is intended only for
> future use (to avoid defining an overload later), these aren't necessarily
> problems.
>
> Also, how do you want to define unused? I suppose a non-escaping closure
> is unused if it's never called (since it can't be stored), but that doesn't
> guarantee that it *will* be called, which is the point of this proposal,
> i.e- a non-escaping closure may be part of a loop that may not execute,
> which is fine since it has no requirement to be used in every call, only
> that it isn't stored.
>
> So yeah, even if a warning like this could be done right, I'm not sure it
> replaces the case put forward for @required.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160817/9ea412b3/attachment.html>


More information about the swift-evolution mailing list