Skip to content

Inconsistencies in the Spec about class #23318

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

Open
fare opened this issue Jun 4, 2025 · 4 comments
Open

Inconsistencies in the Spec about class #23318

fare opened this issue Jun 4, 2025 · 4 comments

Comments

@fare
Copy link

fare commented Jun 4, 2025

  1. The Scala 3.4 specification uses the word "class" inconsistently, sometimes meaning "that Java-inherited concept that only supports single inheritance", sometimes meaning "class or trait". Please be consistent in the specification if nowhere else. Maybe introduce and systematically use a word for class-or-trait; or declare that class (or trait) encompasses both unless specified otherwise ("non-class trait" if trait encompasses both, "non-trait class" if class encompasses both), and use it consistently afterwards. It's a spec, it must be precise.
  2. The Scala 3.4 specification fails to explain that the most-specific superclass (if not Object) need not appear first among the direct super classes-or-traits of a class-or-trait, whereas it needed to in Scala 2.
  3. While we're at it, it really sucks that you use a variant of the LOOPS algorithm for class-or-trait linearization, instead of C3. For why the consistency constraints of C3 matter, see the 1992 and 1994 articles by Ducournau, Habib, Huchard, and Mugnier. I realize this breaks backward compatibility and thus may have to wait until a new major Scala version, though.
@fare fare added the stat:needs triage Every issue needs to have an "area" and "itype" label label Jun 4, 2025
@Gedochao
Copy link
Contributor

Gedochao commented Jun 5, 2025

Hey, can you link specific sections?
Also, just a reminder that Scala 3.4 is no longer supported.
We currently support 3.7 (the current Scala 3 Next) and 3.3 (the current Scala 3 LTS, soon to be replaced with 3.9)

@Gedochao Gedochao added itype:bug stat:needs info area:spec and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jun 5, 2025
@som-snytt
Copy link
Contributor

A trait is a class that is meant to be added to some other class as a mixin.

I don't detect the imprecision.

The section on linearization distinguishes "linearization of a class" and "linearization of mixins", but maybe it could say "linearization of a subclass" instead, for clarity.

The "published" spec calls itself 3.4 but includes latest edits. (I don't know the workflow.)

@Gedochao
Copy link
Contributor

Gedochao commented Jun 5, 2025

The "published" spec calls itself 3.4 but includes latest edits. (I don't know the workflow.)

Oh, now that's worrying... 🤔
cc @WojciechMazur @sjrd

@WojciechMazur
Copy link
Contributor

WojciechMazur commented Jun 5, 2025

The specification is synchronized on each commit to main (merged PR) - it's uploaded to LAMP server building all scala-lang websites

The version showed and the endpoint upon which it would be available is controlled by config

baseurl: /files/archive/spec/3.4
latestScalaVersion: 3.4
thisScalaVersion: 3.4

Currently these are pointing to 3.4.
We can change these, but it would also require additional changes on docs.scala-lang becuse the link to specification is hardcoded : https://github.com/scala/docs.scala-lang/blob/2b612762460ecde204d54fd2afcbd5d77d06fc78/index.md?plain=1#L72-L75

Probably it would be the best to change config and update entry in docs.scala-lang. There is no switch for different versions of specification on that side, but the old versions should still be reachable by links (unless when syncing these would be overrdined, we'd need to confirm that)

I think there is also one more problem - the specification is showing the state of main branch so nightly releases. I belive it would be better if spec would be synced only on stable releases. That's what we do with reference docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants