| Thread overview | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 02, 2015 Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
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 | ||||
December 02, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | 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?
Warning, this is very unsafe and incompatible with the GC. Bit-twiddling GC pointers can lead to memory corruption and very hard-to-track bugs. Such a feature must be opt-in in a very explicit way.
| |||
December 02, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | On 12/02/2015 02:54 PM, Vladimir Panteleev 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?
>
> Warning, this is very unsafe and incompatible with the GC. Bit-twiddling
> GC pointers can lead to memory corruption and very hard-to-track bugs.
> Such a feature must be opt-in in a very explicit way.
Well it's @system. -- Andrei
| |||
December 02, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | 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? | |||
December 02, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to ZombineDev | On Wednesday, 2 December 2015 at 23:04:16 UTC, 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?
Yeah, that'd be great if we could remove these scary warning about the GC on these, this is only FUD. It works just fine with the GC.
| |||
December 02, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to ZombineDev | 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. -- Andrei
| |||
December 02, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to deadalnix | On 12/02/2015 06:38 PM, deadalnix wrote:
> Yeah, that'd be great if we could remove these scary warning about the
> GC on these, this is only FUD. It works just fine with the GC.
LSBs may work, MSBs most likely not. -- Andrei
| |||
December 02, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wednesday, 2 December 2015 at 23:51:40 UTC, Andrei Alexandrescu wrote:
> On 12/02/2015 06:38 PM, deadalnix wrote:
>> Yeah, that'd be great if we could remove these scary warning about the
>> GC on these, this is only FUD. It works just fine with the GC.
>
> LSBs may work, MSBs most likely not. -- Andrei
Yes, this is checking that you are only stealing LSB and check that alignment allows you to steal that much. There are all the checks in place to make it safe.
| |||
December 03, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wednesday, 2 December 2015 at 19:59:14 UTC, Andrei Alexandrescu wrote:
> On 12/02/2015 02:54 PM, Vladimir Panteleev 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?
>>
>> Warning, this is very unsafe and incompatible with the GC. Bit-twiddling
>> GC pointers can lead to memory corruption and very hard-to-track bugs.
>> Such a feature must be opt-in in a very explicit way.
>
> Well it's @system. -- Andrei
Considering that @system is the default, I really don't think that's enough.
| |||
December 03, 2015 Re: Neat project: add pointer capability to std.bitmanip.bitfields | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Vladimir Panteleev | On Thursday, 3 December 2015 at 00:08:17 UTC, Vladimir Panteleev wrote: > On Wednesday, 2 December 2015 at 19:59:14 UTC, Andrei Alexandrescu wrote: >> On 12/02/2015 02:54 PM, Vladimir Panteleev wrote: >>> On Wednesday, 2 December 2015 at 19:39:47 UTC, Andrei Alexandrescu wrote: >>>> [...] >>> >>> Warning, this is very unsafe and incompatible with the GC. Bit-twiddling >>> GC pointers can lead to memory corruption and very hard-to-track bugs. >>> Such a feature must be opt-in in a very explicit way. >> >> Well it's @system. -- Andrei > > Considering that @system is the default, I really don't think that's enough. That just reminded me to file this: https://issues.dlang.org/show_bug.cgi?id=15399 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply