Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Performance problem with for-expression
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rüdiger Klaehn  
View profile   Translate to Translated (View Original)
 More options Apr 25 2012, 3:28 pm
From: Rüdiger Klaehn <rkla...@googlemail.com>
Date: Wed, 25 Apr 2012 21:28:10 +0200
Local: Wed, Apr 25 2012 3:28 pm
Subject: Re: [scala-user] Performance problem with for-expression
On Wed, Apr 25, 2012 at 9:17 PM, Roland Kuhn <goo...@rkuhn.info> wrote:
> Hi Rüdiger,

> On Apr 25, 2012, at 21:12 , Rüdiger Klaehn wrote:

>> I guess the reify macro is part of scala 2.10? My scala console
>> (2.9.1.final) does not know it. The only way to desugar a for loop is
>> to do scala -Xprint:typer -e "..."

> yes, it’s 2.10.

>> I think that the behavior is very surprising and unintuitive. Is there
>> a reason the variable declaration can not be just moved into the
>> closure during for expresison desugaring?

>> I guess I have to go over many lines of code tomorrow and see if there
>> are any occurrences of that pattern.

> As I said, I was also surprised. My guess is that the wrapping inside a Tuple2 (and hence the map() operation) is necessary in the general case to make both x and i available to the code down-stream.

Well, I guess it's just another thing one needs to be aware of.

It wouldn't be so bad if it would be wrapped like (k, (v,x)). But an
unnecessary call to hashCode is a real pain in many cases, especially
in a language like scala where almost everything overrides hashCode.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.