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

"-language:experimental.packageObjectValues" compiler flag seems to be missing #22830

Open
lihaoyi opened this issue Mar 18, 2025 · 8 comments
Open
Labels
area:experimental area:settings Issues tied to command line options & settings. itype:bug

Comments

@lihaoyi
Copy link
Contributor

lihaoyi commented Mar 18, 2025

Compiler version

3.7.0-RC1

Minimized code

"-language:experimental.packageObjectValues"

Output

invalid choice(s) for -language:experimental.packageObjectValues```

Expectation

I would have expected this to work, since it's documented in #22011

@lihaoyi lihaoyi added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 18, 2025
@som-snytt
Copy link
Contributor

som-snytt commented Mar 18, 2025

The test has import language.experimental.packageObjectValues. @lihaoyi

That seems to be it.

@lihaoyi
Copy link
Contributor Author

lihaoyi commented Mar 18, 2025

Thanks @som-snytt! is there any compiler flag I can use to turn it on project-wide?

@lihaoyi
Copy link
Contributor Author

lihaoyi commented Mar 18, 2025

I thought -experimental would do it but it didn't seem to do anything

@lihaoyi
Copy link
Contributor Author

lihaoyi commented Mar 18, 2025

"-language:experimental.packageObjectValues" doesn't seem to work either, says invalid choice(s) for -language:

@lihaoyi
Copy link
Contributor Author

lihaoyi commented Mar 18, 2025

Maybe it needs to be added to this list?

@som-snytt
Copy link
Contributor

som-snytt commented Mar 18, 2025

Ha. I guess this message doesn't mean there is no compiler option.

    /** Experimental support for package object values
     */
    @compileTimeOnly("`packageObjectValues` can only be used at compile time in import statements")
    object packageObjectValues

You must be right.

The funny thing, Dr O complained once about keeping values in sync with options, and I contributed a terrible hack, perhaps my first contribution, that I'm pretty sure was not adopted.

Edit: it doesn't seem so hacky from this perspective.
#9915

@lihaoyi
Copy link
Contributor Author

lihaoyi commented Mar 18, 2025

This kind of "collect a bunch of static definitions in a runtime data structure" is very common. In com-lihaoyi we do it in Mill, MainArgs, Scalatags (the CSS DSL), Cask, and other places. Not an uncommon problem at all. All of my libraries use macros for this

@lihaoyi lihaoyi changed the title Referenceable package objects not working in small example? "-language:experimental.packageObjectValues" compiler flag seems to be missing Mar 18, 2025
@lihaoyi
Copy link
Contributor Author

lihaoyi commented Mar 18, 2025

Updated the issue title and description to refer to the CLI flag problem

@Gedochao Gedochao added area:experimental area:settings Issues tied to command line options & settings. and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:experimental area:settings Issues tied to command line options & settings. itype:bug
Projects
None yet
Development

No branches or pull requests

3 participants