The Artima Developer Community
Sponsored Link

Programming in Scala Forum
Ch2:Step5 pre-post increment operators

1 reply on 1 page. Most recent reply: Nov 23, 2008 7:55 PM by Vladimir Kelman

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Sean Crotty

Posts: 5
Nickname: scrotty
Registered: Dec, 2007

Ch2:Step5 pre-post increment operators Posted: Jun 6, 2008 2:03 PM
Reply to this message Reply
Advertisement
"Note that Java's ++i and i++ don't work in Scala."

Why? It'd be nice to see a footnote describing whether this was because of a limitation of the language or language syntax decision.

It seems from what I've read from Chapter 1, Scala is expressive enough to make such an "operator overloading" (wrong term, I know) possible.

The statement quoted above is begging for more detail! :)


Vladimir Kelman

Posts: 46
Nickname: vkelman
Registered: Feb, 2008

Re: Ch2:Step5 pre-post increment operators Posted: Nov 23, 2008 7:55 PM
Reply to this message Reply
I think that Scala is trying to promote programming with immutable objects, while increment operators are clearly intended to be used in with mutable variables in constructs like (C#)
for (int i = 0; i < 5; i++)
- which would be a bad style for a functional Scala language.

Flat View: This topic has 1 reply on 1 page
Topic: val similar to Java final? Previous Topic   Next Topic Topic: Naive Question

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use