4 ms·
Well, the same argument can be made for pointers, which are clearly harmful to a safe language. Swift does include them, but puts a screaming "Unsafe" in front
by cballard 11y ago
Well, the same argument can be made for pointers, which are clearly harmful to a safe language.
Swift does include them, but puts a screaming "Unsafe" in front of their type names so that it's clear that unless you really know what you're doing, you're probably doing something wrong.
There's no way to do that with a ++ operator, so it's being removed.
- davrosthedalek 11y agoDo really think the complexity of pre/post-in/decrement is on the same level as pointers?
- dragonwriter 11y agoI think the added complexity to added value ratio is worse for pre/post-in/decrement operators than it is for pointers, even if the added complexity is less.
- cballard 11y agoYes - or in the Apple ecosystem, method swizzling is incredibly useful but also incredibly harmful - both to performance through necessitating dynamic dispatch, and to confusion, because WTF, method swizzling?
- deleted 11y ago[deleted]
- Alupis 11y agoI didn't know we were making comparisons between Swift and C. Most people would agree C lets the developer do a lot of terrible things (by design, since some of those terrible things are necessary for low level stuff, which C was targeted at). Pointers are confusing for a lot of people. Which is why almost no modern language uses them. Comparing "++" with C pointers is not a valid argument. Even so, I would never argue to remove pointers from C, since you can optionally not use them. If you don't need that language construct in your program, don't use it. But leave it for others who do want/need it.
- cballard 11y agoThis operator was popularized by C, so comparisons with C make sense. Of course you wouldn't remove pointers from C, the language would barely work if you did. Confusing C-isms like pointers are what Swift is trying to get away from. This is another case of that. "We're making a new language, it isn't C, but will share some characteristics. Which should those be?" is the question being asked here.
- Alupis 11y agoIt seems to me, we're trying to make Swift "beginner-proof". The problem, Swift is unlikely to be a "beginner's language"... since it's predominantly (at least for now) an Apple language; used almost exclusively for making iOS apps. To make an iOS app, you have to have an Apple Developer license, be paid up on fees, own a very expensive Mac, and pay Apple to put your app in the store. None of which is something a beginner, just starting to learn programming, is likely to do.
- cballard 11y agoIt's less beginner-proof, and more "doing bad things proof". The purpose of releasing Swift as open source is that they don't want it to be an Apple language. I can't wait for it to replace Python for scripting - I dread every time I'm writing code without a competent type system. > be paid up on fees This isn't true anymore, FWIW. Also, OS X apps exist.