September 10, 2022

On 9/10/22 1:48 PM, Walter Bright wrote:

>

What's ironic about this discussion is the exact opposite happened with D bitfields.

After implementing it for C, I realized that we could add bitfields to D by simply turning the existing implementation on. The code was already there, it was already supported and debugged.

The other side preferred a template solution that didn't have quite the simple syntax that the C solution had, whereas I thought bitfields would be used enough to justify the simpler builtin syntax.

I'm not sure that's correct. I think we all preferred a cross-platform solution. I.e. a defined bitfield system which does the same thing on all platforms, not necessarily what C does.

I personally dislike the phobos bitfields, just because of how they are specified. I'd much prefer a builtin bitfield system.

-Steve

September 11, 2022
There is dfix, but nobody is actively working on it.
September 10, 2022
On Saturday, 10 September 2022 at 02:17:30 UTC, Walter Bright wrote:
> On 9/9/2022 4:43 PM, Adam D Ruppe wrote:
>>> If you're using a lot of octal literals such that this is an issue, one wonders, what for? The only use I know of is for Unix file permissions.
>> 
>> I keep hitting them in random C code I'm translating. Various unix things beyond file permissions and a hardware manual for a think i had to drive (an rfid chip) used them for various bit triplets too.
>
> octal!433 is really not much different from 0433. It could even be shortened to o!433, exactly the same number of characters as 0o433.
>
> The reasons for adding language syntactic sugar:
>
> 1. its very commonplace
>
> 2. the workarounds are gross
>
> Of course it's a judgement call, and I understand you see them randomly in C code, but does it really pay off? The downside is the language gets bigger and more complex, the spec gets longer, and people who don't come from a C background wonder why their 093 integer isn't 93.
>
> > the newer imported!"std.conv".octal!433 pattern
>
> Nobody would ever write that unless they used octal exactly once, which suggests that octal literals aren't common enough to justify special syntax.
>
>
>> I often prefer using binary literals anyway, but changing something like 0o50000 to binary is a little obnoxious.
>
> I first implemented binary literals in the 1980s, thinking they were cool and useful. They were not and not. I haven't found a reasonable use for them, or ever wanted them. (I prefer writing them in hex notation, as binary literals take up way too much horizontal space. After all, C3 is a lot easier than 11000011. The latter makes my eyes bleed a bit, too.)
>
> Let's simplify D.

I couldn't agree more with this. I've made it clear that I've done some very successful work with D and have been very pleased with the outcome. But this work involved porting C code I wrote 10 years ago that had become ugly (or maybe it always was) and difficult to maintain. The D version is a big improvement.

But if I were starting with an empty editor buffer, would I choose D? Especially to write a garden-variety application rather than bashing hardware registers? Perhaps not. Some of that would be simply that a higher-level language would be more suitable, e.g., Haskell or Scheme, both personal favorites. But some of that would be due to the hangover from C and C++ that D stills exhibits. My opinion: C was a bad language in 1970 and it is horrifying today. C++? Words fail me, unless they are scatological. I think the more D can detach itself from its C heritage and emphasize modern programming language practice (in other words, take advantage of what we have learned in the last 52 years), the better.


September 10, 2022

On Saturday, 10 September 2022 at 19:00:01 UTC, Steven Schveighoffer wrote:

>

On 9/10/22 1:43 PM, Walter Bright wrote:

> >

I implemented them back in the 80s as an extension, and nobody commented on them. I never found a use. As for seeing a use, seeing a use for them and actually using them are different things.

This is your own personal experience, the so many people in this very thread opposing such depreciation clearly shows many people do use and be happy with binary literals!

September 10, 2022
On Saturday, 10 September 2022 at 19:04:30 UTC, rikki cattermole wrote:
> There is dfix, but nobody is actively working on it.

Well, 2to3 is included in the standard distribution of Python.

So where is dfix?

If it's not included in the standard distribution, it can easily go out of sync with the main compiler.
September 11, 2022
https://github.com/dlang-community/dfix
September 10, 2022
On Saturday, 10 September 2022 at 02:31:05 UTC, Walter Bright wrote:
> On 9/9/2022 4:53 PM, Adam D Ruppe wrote:
>> The nice thing is D lets you group the bits withunderscores.
>
> Yes, that is a great feature I copied from Ada, where it had lain forgotten. Now everyone is adding it!
>
>> So you might do like 0b11_111_101_001 which makes it a lot easier to manage and you can group something like a flags register the same way it appears in the documentation.
>
> I haven't seen CPUs that were documented in octal since the PDP-11, even though it didn't quite work with 16 bits. It was a holdover from the 36 bit PDP-10. 8 and 16 bit processors ever since used hex.

8080/8085/Z80 opcodes when expressed in octal are much easier to handle. Emulators is a niche domain but a lot of CPU and peripheral registers have quite often octal fields. Of course, hex is often enough to handle them.

September 10, 2022
On Saturday, 10 September 2022 at 19:14:30 UTC, rikki cattermole wrote:
>
> https://github.com/dlang-community/dfix

Let's add to the standard distribution of D compliers then. I.e dmd, ldc and gdc. It needs to be maintained in the same repo as the main compilers.

September 11, 2022
On 11/09/2022 7:17 AM, mw wrote:
> On Saturday, 10 September 2022 at 19:14:30 UTC, rikki cattermole wrote:
>>
>> https://github.com/dlang-community/dfix
> 
> Let's add to the standard distribution of D compliers then. I.e dmd, ldc and gdc. It needs to be maintained in the same repo as the main compilers.

It doesn't need to be moved.

Its perfectly capable of being updated, its just that nobody cares about it.

See DCD and dfmt as examples, they are up to date and in the same family of tools.
September 10, 2022
On Saturday, 10 September 2022 at 19:17:34 UTC, mw wrote:
> On Saturday, 10 September 2022 at 19:14:30 UTC, rikki cattermole wrote:
>>
>> https://github.com/dlang-community/dfix
>
> Let's add to the standard distribution of D compliers then. I.e dmd, ldc and gdc. It needs to be maintained in the same repo as the main compilers.

https://github.com/dlang-community/dfix/issues/60