> On Dec 11, 2016, at 2:30 AM, Tommaso Piazza via swift-evolution
> wrote:
>
> Hello Derrick,
>
> I did not think of this as a bug but rather as an intentional limitation that
> to me seems a little odd.
>
> Yes, overloads 2,3 have at least ONE operand of type
Hi,
I just wanted to revive this discussion and understand if this is a welcome
change or not.
Right now one can "fake" overload 1 inside NonEmptyArray by doing the following:
```
public struct NonEmptyArray {
private var elements: Array
private init(array: [Element]) {
I cannot reply directly to this message
https://www.mail-archive.com/swift-evolution@swift.org/msg19099.html so I will
reply here instead.
I am suggesting that both behaviours should be allowed to co-exists (which is
already the case, just there is this one exception.)
No matter the
Thanks for the suggestion,
I have updated the proposal with the error and with the notes on `fileprivate`
-> `private`
/Tommaso
On Sunday, December 11, 2016 5:55 AM, Derrick Ho
wrote:
You may want to add the specific error to your proposal.
error: member
imho the current behaviour is fine.
I'll leave aside infix-operators, because with pre/postfix, the situation is
simpler:
It seems slightly confusing to me to declare such an operator somewhere else
but at the type it works on.
Afair the ability to declare an infix operator in a type
Hello Derrick,
I did not think of this as a bug but rather as an intentional limitation that
to me seems a little odd.
Yes, overloads 2,3 have at least ONE operand of type NonEmptyArray so when
declared as static function on NonEmptyArray they work fine. However Overload 1
just mentions
You may want to add the specific error to your proposal.
*error: member operator '•|' must have at least one argument of type
'NonEmptyArray'*
*public static func •|(lhs: Element, rhs: [Element]) ->
NonEmptyArray*
On Sat, Dec 10, 2016 at 11:49 PM Derrick Ho wrote:
I placed he code you wrote in the proposal in playgrounds and it works
perfectly. (reproduced below). Overloading operators used to only happen
globally and since swift 3 they allowed you to put then inside the
class/struct
public struct NonEmptyArray {
fileprivate var elements: Array
I remember mentioning this in a meeting once. The old behavior (post
2.x-mid-operators-in-aggregates) did allow for this, the new one should too.
~Robert Widmann
2016/12/10 20:36、David Sweeris via swift-evolution
のメッセージ:
>
>>> On Dec 10, 2016, at 5:29 PM, David
> On Dec 10, 2016, at 5:29 PM, David Sweeris via swift-evolution
> wrote:
>
>>
>> On Dec 10, 2016, at 4:54 PM, Tommaso Piazza via swift-evolution
>> > wrote:
>>
>> Hello,
>>
>> I have written a small
> On Dec 10, 2016, at 4:54 PM, Tommaso Piazza via swift-evolution
> wrote:
>
> Hello,
>
> I have written a small proposal that would allow overloads of operators in
> structs/classes non only based on the types of the operands but on the return
> type as well.
>
Hello,
I have written a small proposal that would allow overloads of operators in
structs/classes non only based on the types of the operands but on the return
type as well.
Please let me know you thoughts,/Tommaso
12 matches
Mail list logo