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

Remove Support for Small Octals #235

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

gdamore
Copy link

@gdamore gdamore commented Oct 27, 2022

No description provided.

@dkorpel
Copy link
Contributor

dkorpel commented Oct 27, 2022

N.b. the wrong grammar is filed as issue 19070 and has a PR: dlang/dlang.org#3066

@dkorpel
Copy link
Contributor

dkorpel commented Oct 27, 2022

Here's a PR that attempted to implement this: dlang/dmd#8490

@ichordev
Copy link
Contributor

Why not just have leading 0s be ignored? Perhaps with a depreciation warning at first.
Also, I feel like octal integer literals are an integral enough feature to not be relegated to the standard library (which many projects can’t use), so why not propose to expand them again using a different syntax: 0o1234

It just seems a bit reductive to make a breaking change that will benefit nobody who uses the language. I can see the argument for compiler developers, but it’s not that big of a deal.

@gdamore
Copy link
Author

gdamore commented Oct 28, 2022

I would be supportive of an Oo123 syntax. That would be fine, if folks want octal literals.

The problem with the current syntax is that the only octal literals you can express are 01, 02, 03, 04, 05, 06, 07. That's it. All other octals (apart from 0, which is arguably just a decimal literal) are not permitted. The claim is that those 7 specific octals are unambiguous, because they have the same value in octal, decimal (and also hexadecimal).

But this is silly. Either we should eliminate the leading zero, or support it fully. The decision was made to not support it, on the basis that it causes confusion. This might be the sole place that D has made a choice intended to reduce confusion on the part of the developer!

At any rate, I think we should be consistent.

@gdamore
Copy link
Author

gdamore commented Sep 29, 2023

ping?

@mdparker
Copy link
Member

mdparker commented Oct 6, 2023

See #234 (comment)

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