- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
Re: Re: Inconsistency of operators
Tue, 2011-12-06, 20:37
Cay, there's a lot of disagreement but thanks for your endurance. I'm
confident that any changes made will be an improvement!
On Tue, Dec 6, 2011 at 11:26 AM, Cay Horstmann wrote:
> On Tue, Dec 6, 2011 at 6:03 AM, Daniel Sobral wrote:
>> On Mon, Dec 5, 2011 at 19:05, Cay Horstmann wrote:
>>>> Also, if you provide +: as an extractor for all collections, you add
>>>> another inconsistency. Will you also provide :+? What about efficiency
>>> No, I had thought of providing an +: extractor only for lists. It
>>> doesn't make sense to destructure an arbitrary sequence.
>> That's non-sense! If one has to dump List because it sucks for any
>> algorithm that's not stack-based, it doesn't mean getting heads of a
>> sequence stop being useful. In fact, it is expanded by getting lasts
>> as well. And that doesn't even consider the mutable data structures
>> that would benefit from it.
> Nobody wants to "dump List". I merely proposed adding a +: extractor
> so that one could, over time, migrate from the :: operator to the more
> consistent +: operator.
> Right now, we have :: destructuring for lists only. so I don't see
> that it would do any harm defining a +: extractor for lists only.
> Anyway, it's a moot issue. The :: operator for lists seems to be
> entrenched. If :: isn't going to go away, I don't want +: as a
> gratuitous alternative.
>>> If consistency isn't as important as convenience and tradition, I'd
>>> suggest deprecating ++: +=: ++=: :::. These four seem way more trouble
>>> than they are worth.
>> And this is even weirder: you just killed mutable stacks.
> It is interesting that you bring up mutable stacks... Check out the
> API. You can't currently mutate a stack with +=. More inconsistency.
> Nor can you use +=: or ++=:, so taking these away can't have any
> effect on stacks.
> Anyway, there are push and pop :-)
>> Plus removed
>> ::: *and* the only possible right-associative replacement at the same
>> I see a lot of cost and very little gain from what you propose.
> All I suggest is to remove those four operators. I looked at the
> language and compiler source. ++: +=: ++=: are very rarely used. And
> it seems that ::: could be replaced by ++ in all the uses that I've
> analyzed. Given that Martin greatly preferred ++ over the more
> consistent :++ because it is shorter, I feel confident that he'll
> prefer ++ over ::: for the same reason :-)
> Seriously, I don't think I am going to get my way with :::, but
> deprecating ++: +=: ++=: is worth fighting for.