Neat project: add pointer capability to std.bitmanip.bitfields

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 3 04:45:10 PST 2015


On 12/2/15 6:51 PM, Andrei Alexandrescu wrote:
> On 12/02/2015 06:04 PM, ZombineDev wrote:
>> On Wednesday, 2 December 2015 at 19:39:47 UTC, Andrei Alexandrescu wrote:
>>> Once done, this is a fantastic example of (a) the power of generative
>>> programming, and (b) the advantages of using library facilities
>>> instead of built-in features.
>>>
>>> https://issues.dlang.org/show_bug.cgi?id=15397
>>>
>>> Who would want to take it?
>>>
>>>
>>> Andrei
>>
>> So, something like
>> http://dlang.org/phobos/std_bitmanip.html#.taggedPointer?
>
> Sigh, yes. Both taggedPointer and taggedClassRef should be features of
> bitfields, not distinct names. One good thing to do would be to
> integrate those within bitfields, and then later perhaps undocumented.

taggedPointer and taggedClassRef are GC safe (despite the incorrect 
warning listed in the docs). Your proposed mechanism is not.

IMO, we should keep those and close your enhancement, it doesn't add 
anything useful. Seems to me something that can break very easily.

Phobos should in no way support such egregious casts implicitly. Even in 
@system code.

Do you have any rationale to prefer arbitrary bitfield pointers over GC 
safe ones?

-Steve


More information about the Digitalmars-d mailing list