It also helps that many lessons have been learnt from C++, the convention in Scala is to be very pedantic about operator names.
For example, given a list the following two operations are not the same someList plus x someList add y These operators are actually just aliases to their symbolic names though: someList :+ x someList :+= y personally, I think the symbolic notation is clearer and less open to misunderstanding. It also illustrates an issue that Java, without operator overloading, got wrong Java made + do weird and wonderful things in the presence of Strings, Scala duplicates that behaviour in order to not surprise Java converts This also means that we can't simply use + as an operator here, but instead have to use :+ On 9 August 2010 14:00, Fabrizio Giudici <[email protected]>wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > > > > On Aug 9, 3:07 am, Viktor Klang <[email protected]> wrote: > >> > >> > >> ANY word/symbol can be defined to work in a way that is not > >> intuitive, it doesn't matter if we call a method "plus" or "+" if > >> it's not doing addition, it'll be confusing anyway. > >> > There are two differences: > > 1) Full words are obviously less ambiguous than single characters. In > other words, it's much more probable to misuse an operator rather than > misusing an english word (or set of words). > 2) Operators have the precedence thing that is able to confuse a lot > of average programmers. > > There's also the implicit type conversion thing (a real mess in C++) > but if I properly understand it is not a problem with Scala. > > - -- > Fabrizio Giudici - Java Architect, Project Manager > Tidalwave s.a.s. - "We make Java work. Everywhere." > java.net/blog/fabriziogiudici - www.tidalwave.it/people > [email protected] > -----BEGIN PGP SIGNATURE----- > Version: GnuPG/MacGPG2 v2.0.14 (Darwin) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iEYEARECAAYFAkxf/AkACgkQeDweFqgUGxdBbQCgmbPqN5uM8v0soAABHKySWXJz > 0xsAn03pVkUkz1Xj0f3E10jODAYGx5FR > =UknX > -----END PGP SIGNATURE----- > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<javaposse%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > > -- Kevin Wright mail/google talk: [email protected] wave: [email protected] skype: kev.lee.wright twitter: @thecoda -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
