News for hackers. Stuff that matters.
Re:Not Growing a Language by edflsafoiewq on Saturday April 03, 2021 @05:10PM (#26684773)
Well of course, if you look at "mathy" operators like +. If you look at operator[], the use cases are all "collectiony" objects instead.
Re:Not Growing a Language by joshuamorton on Saturday April 03, 2021 @07:27PM (#26685650)
And note that these overlap: think matrices where a + b adds, and a[1:,:,0] may have meaning, requiring the index operator to support tuples and range objects.
Re:Not Growing a Language by AnimalMuppet on Saturday April 03, 2021 @06:38PM (#26685383)
I could even see + on collections: "Add all the elements of this collection to that collection."
Re:Not Growing a Language by erik_seaberg on Saturday April 03, 2021 @07:11PM (#26685571)
Scala used + for an element and ++ for another collection

  scala> 1 +: List(2, 3) ++: List(4, 5) :+ 6
  res0: List[Int] = List(1, 2, 3, 4, 5, 6)
where +: is right-associative and implemented by the list rather than the element.