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

Private vals and case classes (SI-5407)

5 replies
gkossakowski
Joined: 2010-03-11,
User offline. Last seen 33 weeks 5 days ago.
Hi,
I just wanted to drag your attention to: https://issues.scala-lang.org/browse/SI-5407
It contains two goodies: 1. code that compiles and throws CCE even if there is no user-defined casting involved 2. proposed language change.
All this is fairly important as it breaks specs2 (popular testing library) with 2.10.0-M1.

--
Grzegorz Kossakowski

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Private vals and case classes (SI-5407)


On Wed, Jan 25, 2012 at 2:03 AM, Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> wrote:
>
> I just wanted to drag your attention to: https://issues.scala-lang.org/browse/SI-5407
>
> It contains two goodies: 1. code that compiles and throws CCE even if there is no user-defined casting involved 2. proposed language change.

As noted in the ticket, we already went to that language change dance.

   https://issues.scala-lang.org/browse/SI-3714

I know exactly when it regressed, I'll fix it.
gkossakowski
Joined: 2010-03-11,
User offline. Last seen 33 weeks 5 days ago.
Re: Private vals and case classes (SI-5407)
On 25 January 2012 18:10, Paul Phillips <paulp@improving.org> wrote:


On Wed, Jan 25, 2012 at 2:03 AM, Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> wrote:
>
> I just wanted to drag your attention to: https://issues.scala-lang.org/browse/SI-5407
>
> It contains two goodies: 1. code that compiles and throws CCE even if there is no user-defined casting involved 2. proposed language change.

As noted in the ticket, we already went to that language change dance.

   https://issues.scala-lang.org/browse/SI-3714

I know exactly when it regressed, I'll fix it.

I looked into that ticket but I still don't really understand why it's crucial to allow those private vals. If you really need them then why not go with regular class and extractors?
Being able to access private stuff through pattern sounds weird to me. Am I the only one?

--
Grzegorz Kossakowski

extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Private vals and case classes (SI-5407)
BTW, I still kind of like my idea to separate the access of setters and getters, and have the access modifier only apply to the setter for case classes: all getters are public.  I understand why someone wouldn't like it though.
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.
Re: Private vals and case classes (SI-5407)

On Wed, Jan 25, 2012 at 9:13 AM, Grzegorz Kossakowski
wrote:
>
> I looked into that ticket but I still don't really understand why it's crucial to allow those private vals. If you really need them then why not go with regular class and extractors?

Because it would destroy the performance of lists.

> Being able to access private stuff through pattern sounds weird to me. Am I the only one?

Clearly not, as evidenced by the "SOOOOOOOOOOOOOOOOOOLD" in the comments.

gkossakowski
Joined: 2010-03-11,
User offline. Last seen 33 weeks 5 days ago.
Re: Private vals and case classes (SI-5407)
On 25 January 2012 18:22, Paul Phillips <paulp@improving.org> wrote:
On Wed, Jan 25, 2012 at 9:13 AM, Grzegorz Kossakowski
<grzegorz.kossakowski@gmail.com> wrote:
>
> I looked into that ticket but I still don't really understand why it's crucial to allow those private vals. If you really need them then why not go with regular class and extractors?

Because it would destroy the performance of lists.

Oh, I forgot that custom-defined extractor are not handled the same way as synthesized ones. Now it makes sense even if it's really unfortunate.

--
Grzegorz Kossakowski

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