Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Singleton Array default value #10730

Open
hobwekiva opened this issue Feb 17, 2018 · 4 comments
Open

Singleton Array default value #10730

hobwekiva opened this issue Feb 17, 2018 · 4 comments
Milestone

Comments

@hobwekiva
Copy link

hobwekiva commented Feb 17, 2018

scala> val a : Array[1] = new Array(1)
a: Array[1] = Array(0)

scala> val a : Array[1] = Array.ofDim(2)
a: Array[1] = Array(0, 0)

scala> val x : 1 = a(0)
x: 1 = 0

arguably I should not be able to construct 0 : 1 so easily

Tested in 2.13.0-M3 REPL


EDIT: There is no need for arrays:

scala> val a : 1 = a
                   ^
       warning: value a does nothing other than call itself recursively
a: 1 = 0
@milessabin
Copy link

The Array variant is new. There's been some discussion of the non-Array manifestation ... I thought on the SIP-23 PR but I can't find it just now. The TL;DR is that we should make this work the same way as Dotty (which is more in line with your expectations).

@milessabin milessabin self-assigned this Feb 19, 2018
@SethTisue SethTisue added this to the 2.13.0-RC1 milestone Feb 20, 2018
@milessabin milessabin modified the milestones: 2.13.0-RC1, 2.13.0-M4 Mar 2, 2018
@lrytz lrytz modified the milestones: 2.13.0-M4, 2.13.0-M5 Apr 19, 2018
@lrytz lrytz modified the milestones: 2.13.0-M5, Backlog, 2.13.0-RC1 Aug 8, 2018
@milessabin
Copy link

@adriaanm I'm afraid I'm not going to have time to dig in to this for a week or two.

@adriaanm adriaanm modified the milestones: 2.13.0-RC1, 2.13.1 Feb 13, 2019
@szeiger
Copy link
Member

szeiger commented Aug 20, 2019

@milessabin Is there any progress on this for 2.13.1? Otherwise please move to 2.13.2.

@milessabin
Copy link

None, I'm afraid.

@milessabin milessabin modified the milestones: 2.13.1, 2.13.2 Aug 20, 2019
@milessabin milessabin removed their assignment Aug 20, 2019
@SethTisue SethTisue modified the milestones: 2.13.2, Backlog Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants