Same parameter name definition in protocol not emit error

Hi, recently I found that same parameter name defined in protocol is allowed. eg:

public protocol P {
    func blend(fg texture: NSImage, bg texture: NSImage) -> NSImage
}

is that a bug?

Maybe it is. I believe that as the second part of the parameter name is visible only inside the body of the function, and protocols do not have it, maybe it is even not emitted by the protocol.
When conforming to it, you may change texture to whatever pleases you and still be conform.

2 Likes
Terms of Service

Privacy Policy

Cookie Policy