Skip to content

Deprecate 1l and lint 0755#7685

Merged
SethTisue merged 1 commit intoscala:2.13.xfrom
som-snytt:issue/literal-lint
Jan 28, 2019
Merged

Deprecate 1l and lint 0755#7685
SethTisue merged 1 commit intoscala:2.13.xfrom
som-snytt:issue/literal-lint

Conversation

@som-snytt
Copy link
Copy Markdown
Contributor

Advise to use 1L.

Octal syntax error is demoted to lint warning
which can be disabled by power number users,
who can freely write decimals literals with
leading zero.

Squash/rebase of #7388

Advise to use 1L.

Octal syntax error is demoted to lint warning
which can be disabled by power number users,
who can freely write decimals literals with
leading zero.
@scala-jenkins scala-jenkins added this to the 2.13.0-RC1 milestone Jan 25, 2019
nextChar()
getFraction()
}
// 1l is an acknowledged bad practice
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!


def bad = 1l

def worse = 123l
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think 32l is worstest.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or is it worcestershire?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L01, you're right!

@adriaanm
Copy link
Copy Markdown
Contributor

I guess you could say something about 1igatures and lDEs and 1inters, but l agree we don't kneed to confuse. (Ok, I've been staring down the 🐰 🕳 too long today.)

@SethTisue SethTisue added the release-notes worth highlighting in next release notes label Jan 28, 2019
@SethTisue SethTisue merged commit cef5a73 into scala:2.13.x Jan 28, 2019
@SethTisue
Copy link
Copy Markdown
Member

SethTisue commented Jan 28, 2019

but what about Polish ł?

(which in the monospace font in my browser, anyway, kind of looks like a meerkat scanning for predators)

@som-snytt
Copy link
Copy Markdown
Contributor Author

For Polish notation, we recommend uppercase in honor of Łukasiewicz.

@som-snytt som-snytt deleted the issue/literal-lint branch January 28, 2019 19:40
@SethTisue
Copy link
Copy Markdown
Member

SethTisue commented Mar 18, 2019

@som-snytt is something wrong here that I don't get a "warning: there was one deprecation warning" meta-warning in the REPL? it doesn't match the behavior of ordinary method deprecations, as shown in this transcript:

Welcome to Scala 2.13.0-pre-f1dec97 [...]

scala> (new Thread).stop()
warning: there was one deprecation warning; for details, enable `:setting -deprecation' or `:replay -deprecation'

scala> 1l
res1: Long = 1

scala> :reset -deprecation
Resetting interpreter state. [...]

scala> 1l
        ^
       warning: Lowercase el for long is not recommended because it is easy to confuse with numeral 1; use uppercase L instead
res0: Long = 1

this came up over at #7458, where @lrytz's PR had 1l in it and @Ichoran noticed

in scala/scala we don't have -deprecation enabled because it would produce an enormous amount of noise, in which other warnings would drown. (and our build actually doesn't have many other warnings, these days.)

@som-snytt
Copy link
Copy Markdown
Contributor Author

@SethTisue the refactored REPL doesn't show parsing deprecations; there is a ticket, but I haven't addressed it.

@SethTisue
Copy link
Copy Markdown
Member

oh ok, it's scala/bug#11402, thanks

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

Labels

release-notes worth highlighting in next release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants