- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Private vals and case classes (SI-5407)
Wed, 2012-01-25, 11:04
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
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
Wed, 2012-01-25, 18:21
#2
Re: Private vals and case classes (SI-5407)
On 25 January 2012 18:10, Paul Phillips <paulp@improving.org> 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?
Being able to access private stuff through pattern sounds weird to me. Am I the only one?
--
Grzegorz Kossakowski
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
Wed, 2012-01-25, 18:31
#3
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.
Wed, 2012-01-25, 18:31
#4
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.
Wed, 2012-01-25, 18:51
#5
Re: Private vals and case classes (SI-5407)
On 25 January 2012 18:22, Paul Phillips <paulp@improving.org> wrote:
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
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
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.