++ and --

Hello,
I would like to share my opinion on -- and ++ operators...
I think that ++ and — should stay and MUST be implemented as faster operations than += and -=.They have very specific job after all and that is the general understanding. If you fail to implement them as faster operators that will really look as major weakness of SWIFT development team. Swift is still too slow – try working with Arrays so having these faster operators that are very commonly used will be a plus. Another plus will be that you will not break tons of existing code. Breaking existing code is always considered as an architecture weakness and always have a negative impact on the whole developers community – take a look at Microsoft for example they often do that mistake…. Android on the other hand is till that moment always building over the old (however they make other mistakes

I think that ++ and — should stay and MUST be implemented as faster operations than += and -=.

If there is an easy way to make operations faster, imho that should be applied to every method ;-)

Jokes apart, compilers of today know some really smart tricks, so if "+= 1" is slower than "++", I'd consider that a bug.

Note that += 1 and -= 1 compile to the same assembly as ++ and -- respectively
and therefore have identical performance.

···

On Wed, Mar 23, 2016 at 9:44 PM, Biala via swift-evolution < swift-evolution@swift.org> wrote:

Hello,

I would like to share my opinion on -- and ++ operators...

I think that ++ and — should stay and MUST be implemented as faster
operations than += and -=.They have very specific job after all and that is
the general understanding. If you fail to implement them as faster
operators that will really look as major weakness of SWIFT development
team. Swift is still too slow – try working with Arrays so having these
faster operators that are very commonly used will be a plus. Another plus
will be that you will not break tons of existing code. Breaking existing
code is always considered as an architecture weakness and always have a
negative impact on the whole developers community – take a look at
Microsoft for example they often do that mistake…. Android on the other
hand is till that moment always building over the old (however they make
other mistakes [image: :wink:]

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

This pre-proposal needs to answer a few questions before it can really go
anywhere:

- What sort of mechanism can ++/-- exploit, that "+= 1" or "-= 1" can't, to
make the former perform better than the latter? It would be helpful to have
at least a vague idea as to whether this is even possible, or else the
proposal is meaningless.

- Exactly how is adding in a faster ++/-- operator going to address Swift's
performance problems? For example, how is ++/-- going to make arrays
perform better?

- Why were the (multiple) arguments made in favor of the proposal to remove
++/-- weak or incorrect? What arguments in favor of keeping ++/-- are
stronger than their counterparts?

Best,
Austin

···

On Wed, Mar 23, 2016 at 6:44 PM, Biala via swift-evolution < swift-evolution@swift.org> wrote:

Hello,

I would like to share my opinion on -- and ++ operators...

I think that ++ and — should stay and MUST be implemented as faster
operations than += and -=.They have very specific job after all and that is
the general understanding. If you fail to implement them as faster
operators that will really look as major weakness of SWIFT development
team. Swift is still too slow – try working with Arrays so having these
faster operators that are very commonly used will be a plus. Another plus
will be that you will not break tons of existing code. Breaking existing
code is always considered as an architecture weakness and always have a
negative impact on the whole developers community – take a look at
Microsoft for example they often do that mistake…. Android on the other
hand is till that moment always building over the old (however they make
other mistakes [image: :wink:]

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

First of all, I am not a big fan of removal of "++" operator. Still,
"+= 1" has the same performance with "++" but since I like the comfort of
writing just "++", I will just write an extension when Swift 3 will be
released. I know many people who will do the same.

···

On 23 March 2016 at 13:09, Tino Heth via swift-evolution < swift-evolution@swift.org> wrote:

I think that ++ and — should stay and MUST be implemented as faster
operations than += and -=.

If there is an easy way to make operations faster, imho that should be
applied to every method ;-)

Jokes apart, compilers of today know some really smart tricks, so if "+=
1" is slower than "++", I'd consider that a bug.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

I'd be willing to keep "++" and "--" if they stopped having a return type.
"x++" is fine; "let y = x++" is where we lose clarity, so I'd much prefer
to see that expressed as "let y = x + 1; x++".

···

On Wed, Mar 23, 2016 at 1:10 PM, Ergin Bilgin via swift-evolution < swift-evolution@swift.org> wrote:

    First of all, I am not a big fan of removal of "++" operator. Still,
"+= 1" has the same performance with "++" but since I like the comfort of
writing just "++", I will just write an extension when Swift 3 will be
released. I know many people who will do the same.

On 23 March 2016 at 13:09, Tino Heth via swift-evolution < > swift-evolution@swift.org> wrote:

I think that ++ and — should stay and MUST be implemented as faster
operations than += and -=.

If there is an easy way to make operations faster, imho that should be
applied to every method ;-)

Jokes apart, compilers of today know some really smart tricks, so if "+=
1" is slower than "++", I'd consider that a bug.

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Personally I don’t see the point; ++ and — only really offer an advantage when they’re being used within conditions/expressions, but as you say that’s when they are at their most dangerous. As single line statements they offer no real saving over += 1 or -= 1, while requiring an additional operator covering all the various integer types. By forcing += 1 and -= 1 we also make sure that all assignment operations contain an equals sign, which I think is good for consistency.

For anyone that is desperately attached to using the operator then it’s not hard to add them back in, but I’ve used these for years and have no special fondness for them.

···

On 23 Mar 2016, at 13:33, Ross O'Brien via swift-evolution <swift-evolution@swift.org> wrote:

I'd be willing to keep "++" and "--" if they stopped having a return type. "x++" is fine; "let y = x++" is where we lose clarity, so I'd much prefer to see that expressed as "let y = x + 1; x++”.