This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Am I dealing with a bug in the scala compiler?

9 replies
GA
Joined: 2009-10-23,
User offline. Last seen 42 years 45 weeks ago.
Hello guys,
something very strange is happening.
I have the following case class:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, qualificationChanged: Boolean )
This compiles perfectly. But this one doesn't:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, ppppp: Long, qualificationChanged: Boolean )
I have just added a field. The error is the following:

error: type Function23 is not a member of package scala case class UpdatedFeeds(feedId: Long,                                   ^one error found

Any ideas what it is happening?
Thanks in advance,
GA

Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: Am I dealing with a bug in the scala compiler?
22 parameters should be enough for anyone.

On Tue, Jan 5, 2010 at 9:39 AM, GA <my_lists@me.com> wrote:
Hello guys,
something very strange is happening.
I have the following case class:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, qualificationChanged: Boolean )
This compiles perfectly. But this one doesn't:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, ppppp: Long, qualificationChanged: Boolean )
I have just added a field. The error is the following:

error: type Function23 is not a member of package scala case class UpdatedFeeds(feedId: Long,                                   ^one error found

Any ideas what it is happening?
Thanks in advance,
GA




--
Viktor Klang
| "A complex system that works is invariably
| found to have evolved from a simple system
| that worked." - John Gall

Blog: klangism.blogspot.com
Twttr: twitter.com/viktorklang
Code: github.com/viktorklang
GA
Joined: 2009-10-23,
User offline. Last seen 42 years 45 weeks ago.
Re: Am I dealing with a bug in the scala compiler?
Fanny, this just compiles correctly:
    case class QualificationFields(previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int   )

        

case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, qualificationFields: QualificationFields, pppp: Long, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, qualificationChanged: Boolean )

Why is this limitation of 22 fields?

On Jan 5, 2010, at 9:45 AM, Viktor Klang wrote:
22 parameters should be enough for anyone.

On Tue, Jan 5, 2010 at 9:39 AM, GA <my_lists@me.com> wrote:
Hello guys,
something very strange is happening.
I have the following case class:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, qualificationChanged: Boolean )
This compiles perfectly. But this one doesn't:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, ppppp: Long, qualificationChanged: Boolean )
I have just added a field. The error is the following:

error: type Function23 is not a member of package scala case class UpdatedFeeds(feedId: Long,                                   ^one error found

Any ideas what it is happening?
Thanks in advance,
GA




--
Viktor Klang
| "A complex system that works is invariably
| found to have evolved from a simple system
| that worked." - John Gall

Blog: klangism.blogspot.com
Twttr: twitter.com/viktorklang
Code: github.com/viktorklang

GA
Joined: 2009-10-23,
User offline. Last seen 42 years 45 weeks ago.
Re: Am I dealing with a bug in the scala compiler?
Well, obviously not for me.
This is part of a complex API.
On Jan 5, 2010, at 9:45 AM, Viktor Klang wrote:
22 parameters should be enough for anyone.

On Tue, Jan 5, 2010 at 9:39 AM, GA <my_lists@me.com> wrote:
Hello guys,
something very strange is happening.
I have the following case class:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, qualificationChanged: Boolean )
This compiles perfectly. But this one doesn't:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, ppppp: Long, qualificationChanged: Boolean )
I have just added a field. The error is the following:

error: type Function23 is not a member of package scala case class UpdatedFeeds(feedId: Long,                                   ^one error found

Any ideas what it is happening?
Thanks in advance,
GA




--
Viktor Klang
| "A complex system that works is invariably
| found to have evolved from a simple system
| that worked." - John Gall

Blog: klangism.blogspot.com
Twttr: twitter.com/viktorklang
Code: github.com/viktorklang

Stefan Langer
Joined: 2009-10-23,
User offline. Last seen 42 years 45 weeks ago.
Re: Am I dealing with a bug in the scala compiler?
You should seriously reconsider your class design. Think about the roles the parameters are playing and then redesign your classes according to those roles. Unless you are working on a seriously resource limited device (in which case I wouldn't expect you to use scala) I see no reason for creating classes with so many collaborators.

Regards
Stefan

2010/1/5 GA <my_lists@me.com>
Well, obviously not for me.
This is part of a complex API.
On Jan 5, 2010, at 9:45 AM, Viktor Klang wrote:
22 parameters should be enough for anyone.

On Tue, Jan 5, 2010 at 9:39 AM, GA <my_lists@me.com> wrote:
Hello guys,
something very strange is happening.
I have the following case class:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, qualificationChanged: Boolean )
This compiles perfectly. But this one doesn't:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, ppppp: Long, qualificationChanged: Boolean )
I have just added a field. The error is the following:

error: type Function23 is not a member of package scala case class UpdatedFeeds(feedId: Long,                                   ^one error found

Any ideas what it is happening?
Thanks in advance,
GA




--
Viktor Klang
| "A complex system that works is invariably
| found to have evolved from a simple system
| that worked." - John Gall

Blog: klangism.blogspot.com
Twttr: twitter.com/viktorklang
Code: github.com/viktorklang


david.bernard
Joined: 2009-01-08,
User offline. Last seen 1 year 27 weeks ago.
Re: Am I dealing with a bug in the scala compiler?

You could restructure by using something like :

case class QualificationV (prev : Int, current : Int)

case class UpdatedFeeds(feedId: Long,
read: Boolean,
qualification: QualificationV,
qualificationWritting: QualificationV,
qualificationAccuracy: QualificationV,
qualificationCompletion: QualificationV,
qualificationEasyToRead: QualificationV,
flag: Long,
flagChanged: Boolean,
classification: Long,
classificationChanged: Boolean,
deepRead: Boolean,
shared: Boolean,
readChanged: Boolean,
deepReadChanged: Boolean,
sharedChanged: Boolean,
ppppp: Long,
qualificationChanged: Boolean
)

...

/davidB

On Tue, Jan 5, 2010 at 09:48, GA wrote:
> Well, obviously not for me.
> This is part of a complex API.
> On Jan 5, 2010, at 9:45 AM, Viktor Klang wrote:
>
> 22 parameters should be enough for anyone.
>
> On Tue, Jan 5, 2010 at 9:39 AM, GA wrote:
>>
>> Hello guys,
>> something very strange is happening.
>> I have the following case class:
>> case class UpdatedFeeds(feedId: Long,
>> read: Boolean,
>> previousQualification: Int,
>> qualification: Int,
>> prevQualificationWritting: Int,
>> qualificationWritting: Int,
>> prevQualificationAccuracy: Int,
>> qualificationAccuracy: Int,
>> prevQualificationCompletion: Int,
>> qualificationCompletion: Int,
>> prevQualificationEasyToRead: Int,
>> qualificationEasyToRead: Int,
>> flag: Long,
>> flagChanged: Boolean,
>> classification: Long,
>> classificationChanged: Boolean,
>> deepRead: Boolean,
>> shared: Boolean,
>> readChanged: Boolean,
>> deepReadChanged: Boolean,
>> sharedChanged: Boolean,
>> qualificationChanged: Boolean
>> )
>> This compiles perfectly. But this one doesn't:
>> case class UpdatedFeeds(feedId: Long,
>> read: Boolean,
>> previousQualification: Int,
>> qualification: Int,
>> prevQualificationWritting: Int,
>> qualificationWritting: Int,
>> prevQualificationAccuracy: Int,
>> qualificationAccuracy: Int,
>> prevQualificationCompletion: Int,
>> qualificationCompletion: Int,
>> prevQualificationEasyToRead: Int,
>> qualificationEasyToRead: Int,
>> flag: Long,
>> flagChanged: Boolean,
>> classification: Long,
>> classificationChanged: Boolean,
>> deepRead: Boolean,
>> shared: Boolean,
>> readChanged: Boolean,
>> deepReadChanged: Boolean,
>> sharedChanged: Boolean,
>> ppppp: Long,
>> qualificationChanged: Boolean
>> )
>> I have just added a field. The error is the following:
>>
>> error: type Function23 is not a member of package scala
>> case class UpdatedFeeds(feedId: Long,
>>                                    ^
>> one error found
>>
>> Any ideas what it is happening?
>> Thanks in advance,
>> GA
>>
>
>
>
> --
> Viktor Klang
> | "A complex system that works is invariably
> | found to have evolved from a simple system
> | that worked." - John Gall
>
> Blog: klangism.blogspot.com
> Twttr: twitter.com/viktorklang
> Code: github.com/viktorklang
>
>

Kevin Wright
Joined: 2009-06-09,
User offline. Last seen 49 weeks 3 days ago.
Re: Am I dealing with a bug in the scala compiler?
Anything with a constructor of this size is just *screaming* anti-pattern at me.
As with the prev/current split already proposed, you want to factor out common attributes into their own traits. Maybe create a monad similar to Option that holds both a value and whether or not it has changed.
sealed abstract class Changable[+T] (val v : T)case class Unchanged[+T](val v : T) extends Changable[T] case class Changed[+T](val v : T) extends Changable[T]
(note: implementation not shown, look at Option.scala or Lift's Box class for reference)
Then you can start using paramaters such as `classification : Changable[Long]` instead of `classification : Long` and `classificationChanged : Boolean`
The advantage of using a true monad is you can begin using map and for-comprehensions to transform values while retaining information as to whether a value is changed or unchanged.  It also provides some very clean semantic meaning and should be heavily re-usable throughout your design.


If this is too much for you, try using (i.e) `classification : Pair[Long, Boolean]` and supply the argument either in tuple form or with the arrow operator:
So given the definition:def fun(classification : Pair[Long, Boolean], flag : Pair[Long, Boolean])
It can be called via either of the followingfun((5L,true), (0L,false)) fun(5L -> true, 0L -> false) 


Getting the parameter count down will help you avoid a future maintenance headache that's going to be far, far more painful than the 22 parameter limit


2010/1/5 Stefan Langer <mailtolanger@googlemail.com>
You should seriously reconsider your class design. Think about the roles the parameters are playing and then redesign your classes according to those roles. Unless you are working on a seriously resource limited device (in which case I wouldn't expect you to use scala) I see no reason for creating classes with so many collaborators.

Regards
Stefan

2010/1/5 GA <my_lists@me.com>
Well, obviously not for me.
This is part of a complex API.
On Jan 5, 2010, at 9:45 AM, Viktor Klang wrote:
22 parameters should be enough for anyone.

On Tue, Jan 5, 2010 at 9:39 AM, GA <my_lists@me.com> wrote:
Hello guys,
something very strange is happening.
I have the following case class:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, qualificationChanged: Boolean )
This compiles perfectly. But this one doesn't:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, ppppp: Long, qualificationChanged: Boolean )
I have just added a field. The error is the following:

error: type Function23 is not a member of package scala case class UpdatedFeeds(feedId: Long,                                   ^one error found

Any ideas what it is happening?
Thanks in advance,
GA




--
Viktor Klang
| "A complex system that works is invariably
| found to have evolved from a simple system
| that worked." - John Gall

Blog: klangism.blogspot.com
Twttr: twitter.com/viktorklang
Code: github.com/viktorklang





--
Kevin Wright

mail/google talk: kev.lee.wright@googlemail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda

Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: Am I dealing with a bug in the scala compiler?

This is only a limitation of case classes. If you really need more
parameters, use a regular class. You also need to write your own
equals / hashCode and toString, if you need them.

As has been pointed out by others, extracting related parameters to
classes is a better design. But there may be valid reasons to have >
22 parameters, perhaps in generated code.

-jason

On Tue, Jan 5, 2010 at 9:51 AM, Guillermo Acilu wrote:

> Why is this limitation of 22 fields?

GA
Joined: 2009-10-23,
User offline. Last seen 42 years 45 weeks ago.
Re: Am I dealing with a bug in the scala compiler?
Thanks for the suggestions guys.
I did not know about this limit in the case classes.
The problem was that this class is directly matched against a JSON message and to change the structure of the class, we need to change the message format or change the way we parse it.
We will probably change the message design.
Thanks again,
GA



On Jan 5, 2010, at 10:59 AM, Kevin Wright wrote:
Anything with a constructor of this size is just *screaming* anti-pattern at me.
As with the prev/current split already proposed, you want to factor out common attributes into their own traits. Maybe create a monad similar to Option that holds both a value and whether or not it has changed.
sealed abstract class Changable[+T] (val v : T)case class Unchanged[+T](val v : T) extends Changable[T] case class Changed[+T](val v : T) extends Changable[T]
(note: implementation not shown, look at Option.scala or Lift's Box class for reference)
Then you can start using paramaters such as `classification : Changable[Long]` instead of `classification : Long` and `classificationChanged : Boolean`
The advantage of using a true monad is you can begin using map and for-comprehensions to transform values while retaining information as to whether a value is changed or unchanged.  It also provides some very clean semantic meaning and should be heavily re-usable throughout your design.


If this is too much for you, try using (i.e) `classification : Pair[Long, Boolean]` and supply the argument either in tuple form or with the arrow operator:
So given the definition:def fun(classification : Pair[Long, Boolean], flag : Pair[Long, Boolean])
It can be called via either of the followingfun((5L,true), (0L,false)) fun(5L -> true, 0L -> false) 


Getting the parameter count down will help you avoid a future maintenance headache that's going to be far, far more painful than the 22 parameter limit


2010/1/5 Stefan Langer <mailtolanger@googlemail.com>
You should seriously reconsider your class design. Think about the roles the parameters are playing and then redesign your classes according to those roles. Unless you are working on a seriously resource limited device (in which case I wouldn't expect you to use scala) I see no reason for creating classes with so many collaborators.

Regards
Stefan

2010/1/5 GA <my_lists@me.com>
Well, obviously not for me.
This is part of a complex API.
On Jan 5, 2010, at 9:45 AM, Viktor Klang wrote:
22 parameters should be enough for anyone.

On Tue, Jan 5, 2010 at 9:39 AM, GA <my_lists@me.com> wrote:
Hello guys,
something very strange is happening.
I have the following case class:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, qualificationChanged: Boolean )
This compiles perfectly. But this one doesn't:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, ppppp: Long, qualificationChanged: Boolean )
I have just added a field. The error is the following:

error: type Function23 is not a member of package scala case class UpdatedFeeds(feedId: Long,                                   ^one error found

Any ideas what it is happening?
Thanks in advance,
GA




--
Viktor Klang
| "A complex system that works is invariably
| found to have evolved from a simple system
| that worked." - John Gall

Blog: klangism.blogspot.com
Twttr: twitter.com/viktorklang
Code: github.com/viktorklang





--
Kevin Wright

mail/google talk: kev.lee.wright@googlemail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda


dcsobral
Joined: 2009-04-23,
User offline. Last seen 38 weeks 5 days ago.
Re: Am I dealing with a bug in the scala compiler?
Product, Function, Tuple... any class that has _exactly_ N parameters (instead of varargs) has to be duplicated in the library for each value of N. In particular, case classes inherit Product, and that's where the limit comes from.
An arbitrary limit was drawn at 22. As mentioned, you can avoid it by avoiding case classes.

On Tue, Jan 5, 2010 at 8:45 AM, GA <my_lists@me.com> wrote:
Thanks for the suggestions guys.
I did not know about this limit in the case classes.
The problem was that this class is directly matched against a JSON message and to change the structure of the class, we need to change the message format or change the way we parse it.
We will probably change the message design.
Thanks again,
GA



On Jan 5, 2010, at 10:59 AM, Kevin Wright wrote:
Anything with a constructor of this size is just *screaming* anti-pattern at me.
As with the prev/current split already proposed, you want to factor out common attributes into their own traits. Maybe create a monad similar to Option that holds both a value and whether or not it has changed.
sealed abstract class Changable[+T] (val v : T)case class Unchanged[+T](val v : T) extends Changable[T] case class Changed[+T](val v : T) extends Changable[T]
(note: implementation not shown, look at Option.scala or Lift's Box class for reference)
Then you can start using paramaters such as `classification : Changable[Long]` instead of `classification : Long` and `classificationChanged : Boolean`
The advantage of using a true monad is you can begin using map and for-comprehensions to transform values while retaining information as to whether a value is changed or unchanged.  It also provides some very clean semantic meaning and should be heavily re-usable throughout your design.


If this is too much for you, try using (i.e) `classification : Pair[Long, Boolean]` and supply the argument either in tuple form or with the arrow operator:
So given the definition:def fun(classification : Pair[Long, Boolean], flag : Pair[Long, Boolean])
It can be called via either of the followingfun((5L,true), (0L,false)) fun(5L -> true, 0L -> false) 


Getting the parameter count down will help you avoid a future maintenance headache that's going to be far, far more painful than the 22 parameter limit


2010/1/5 Stefan Langer <mailtolanger@googlemail.com>
You should seriously reconsider your class design. Think about the roles the parameters are playing and then redesign your classes according to those roles. Unless you are working on a seriously resource limited device (in which case I wouldn't expect you to use scala) I see no reason for creating classes with so many collaborators.

Regards
Stefan

2010/1/5 GA <my_lists@me.com>
Well, obviously not for me.
This is part of a complex API.
On Jan 5, 2010, at 9:45 AM, Viktor Klang wrote:
22 parameters should be enough for anyone.

On Tue, Jan 5, 2010 at 9:39 AM, GA <my_lists@me.com> wrote:
Hello guys,
something very strange is happening.
I have the following case class:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, qualificationChanged: Boolean )
This compiles perfectly. But this one doesn't:
case class UpdatedFeeds(feedId: Long, read: Boolean, previousQualification: Int, qualification: Int, prevQualificationWritting: Int, qualificationWritting: Int, prevQualificationAccuracy: Int, qualificationAccuracy: Int, prevQualificationCompletion: Int, qualificationCompletion: Int, prevQualificationEasyToRead: Int, qualificationEasyToRead: Int, flag: Long, flagChanged: Boolean, classification: Long, classificationChanged: Boolean, deepRead: Boolean, shared: Boolean, readChanged: Boolean, deepReadChanged: Boolean, sharedChanged: Boolean, ppppp: Long, qualificationChanged: Boolean )
I have just added a field. The error is the following:

error: type Function23 is not a member of package scala case class UpdatedFeeds(feedId: Long,                                   ^one error found

Any ideas what it is happening?
Thanks in advance,
GA




--
Viktor Klang
| "A complex system that works is invariably
| found to have evolved from a simple system
| that worked." - John Gall

Blog: klangism.blogspot.com
Twttr: twitter.com/viktorklang
Code: github.com/viktorklang





--
Kevin Wright

mail/google talk: kev.lee.wright@googlemail.com
wave: kev.lee.wright@googlewave.com
skype: kev.lee.wright
twitter: @thecoda





--
Daniel C. Sobral

I travel to the future all the time.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland