Regarding the proposed Binray Literals Deprecation
Steven Schveighoffer
schveiguy at gmail.com
Wed Sep 14 14:28:40 UTC 2022
On 9/14/22 1:58 AM, Walter Bright wrote:
> On 9/13/2022 7:56 PM, Steven Schveighoffer wrote:
>> But it doesn't disprove the fact that *sometimes*, hex digits aren't
>> as clear.
>
> Does sometimes justify a language feature, when there are other ways?
This isn't Go. We have comfort features that make code easier to read
and write. binary literals cost nothing to have. There is no cost on the
user, and no cost on the compiler (parsing a binary literal isn't any
more taxing than parsing a hex literal).
If we were talking about adding binary literals, when it's possible to
do it via a template, maybe you have a point. But we aren't. We are
talking about *removing* a *zero-cost* feature.
Can you describe exactly what is gained by removing binary literals? If
you think it's because the compiler gets simpler, think again. The
*only* code that is removed is this:
https://github.com/dlang/dmd/blob/978cd5d766f22957e029754f43245e9d76830d70/compiler/src/dmd/lexer.d#L1979-L1985
Half of which is dealing with ImportC.
>
> People often complain that D has too many features. What features would
> you say are not worth it?
>
There's a difference between "not worth adding" and "not worth keeping".
Removing features needs a very high bar to make sense. Adding features
also needs a high bar, considering that it's more difficult to remove
later than it is to not add it.
That being said, if binary literals weren't in the language, I'd be fine
adding them. They don't cost anything, and add a way to write code that
is clearer in some cases.
If I had to pick at gunpoint an established language feature to remove,
it would be betterC. But I can't see any features I'd *want* to remove.
D's features are pretty nice.
-Steve
More information about the Digitalmars-d
mailing list