Removing logical operators


(Pranjal Satija) #1

Hi there,

I had an idea recently about the use of logical operators in Swift, specifically && and ||. I felt that it would be more clear to replace these with the words “and” and “or”. And since most keywords can be used as argument labels in functions now, this should be more feasible than ever. I understand that it isn’t a huge difference, but I feel like it might help make code easier to read, and it would also reduce some confusion for beginners. Could you let me know what you think?


(Saagar Jha) #2

Well, IIRC Swift doesn’t allow operators that aren’t (math) symbols, right?
That might be the first barrier to clear.

···

On Wed, Jun 8, 2016 at 2:24 PM Pranjal Satija via swift-evolution < swift-evolution@swift.org> wrote:

Hi there,

I had an idea recently about the use of logical operators in Swift,
specifically && and ||. I felt that it would be more clear to replace these
with the words “and” and “or”. And since most keywords can be used as
argument labels in functions now, this should be more feasible than ever. I
understand that it isn’t a huge difference, but I feel like it might help
make code easier to read, and it would also reduce some confusion for
beginners. Could you let me know what you think?
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

--
-Saagar Jha


(Saagar Jha) #3

I think keeping operators as actual operators is preferable. Having *some* but
not all operators be keywords makes them “special” and unique, which they
aren’t.

···

On Wed, Jun 8, 2016 at 2:26 PM Saagar Jha <saagarjha28@gmail.com> wrote:

Well, IIRC Swift doesn’t allow operators that aren’t (math) symbols,
right? That might be the first barrier to clear.

On Wed, Jun 8, 2016 at 2:24 PM Pranjal Satija via swift-evolution < > swift-evolution@swift.org> wrote:

Hi there,

I had an idea recently about the use of logical operators in Swift,
specifically && and ||. I felt that it would be more clear to replace these
with the words “and” and “or”. And since most keywords can be used as
argument labels in functions now, this should be more feasible than ever. I
understand that it isn’t a huge difference, but I feel like it might help
make code easier to read, and it would also reduce some confusion for
beginners. Could you let me know what you think?
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

--
-Saagar Jha

--
-Saagar Jha


(Adam Nemecek) #4

https://lists.swift.org/pipermail/swift-evolution/2015-December/000032.html

···

On Wed, Jun 8, 2016 at 2:30 PM, Saagar Jha via swift-evolution < swift-evolution@swift.org> wrote:

I think keeping operators as actual operators is preferable. Having *some* but
not all operators be keywords makes them “special” and unique, which they
aren’t.

On Wed, Jun 8, 2016 at 2:26 PM Saagar Jha <saagarjha28@gmail.com> wrote:

Well, IIRC Swift doesn’t allow operators that aren’t (math) symbols,
right? That might be the first barrier to clear.

On Wed, Jun 8, 2016 at 2:24 PM Pranjal Satija via swift-evolution < >> swift-evolution@swift.org> wrote:

Hi there,

I had an idea recently about the use of logical operators in Swift,
specifically && and ||. I felt that it would be more clear to replace these
with the words “and” and “or”. And since most keywords can be used as
argument labels in functions now, this should be more feasible than ever. I
understand that it isn’t a huge difference, but I feel like it might help
make code easier to read, and it would also reduce some confusion for
beginners. Could you let me know what you think?
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

--
-Saagar Jha

--
-Saagar Jha

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


(Jordan Rose) #5

Please see the list of "commonly proposed changes", which discusses this. https://github.com/apple/swift-evolution/blob/master/commonly_proposed.md

Jordan

···

On Jun 8, 2016, at 14:30, Saagar Jha via swift-evolution <swift-evolution@swift.org> wrote:

I think keeping operators as actual operators is preferable. Having some but not all operators be keywords makes them “special” and unique, which they aren’t.

On Wed, Jun 8, 2016 at 2:26 PM Saagar Jha <saagarjha28@gmail.com <mailto:saagarjha28@gmail.com>> wrote:
Well, IIRC Swift doesn’t allow operators that aren’t (math) symbols, right? That might be the first barrier to clear.

On Wed, Jun 8, 2016 at 2:24 PM Pranjal Satija via swift-evolution <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote:
Hi there,

I had an idea recently about the use of logical operators in Swift, specifically && and ||. I felt that it would be more clear to replace these with the words “and” and “or”. And since most keywords can be used as argument labels in functions now, this should be more feasible than ever. I understand that it isn’t a huge difference, but I feel like it might help make code easier to read, and it would also reduce some confusion for beginners. Could you let me know what you think?
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution
--
-Saagar Jha
--
-Saagar Jha
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org <mailto:swift-evolution@swift.org>
https://lists.swift.org/mailman/listinfo/swift-evolution