The D standard library is built on GC, is that a negative or positive?
Nick Treleaven
nick at geany.org
Wed Dec 21 12:44:18 UTC 2022
On Friday, 16 December 2022 at 13:56:19 UTC, bauss wrote:
> On Friday, 16 December 2022 at 13:25:25 UTC, Nick Treleaven
> wrote:
>> This pull disallows throwing an immutable object:
>>
>> https://github.com/dlang/dmd/pull/14706
>>
>> You can still throw a const object though, which would work
>> for your `enforce`.
Of course that was changed as immutable can convert to const
before throwing, and const shouldn't be violated even if not
immutable.
> Personally I think it should always just be implied const like:
>
> catch (Exception e) should imply catch (const e) that way both
> mutable and immutable will work.
That solves the throw/catch qualifier mismatch problem, but it
still can violate immutable when the runtime sets the stack
trace. Also not sure if the runtime may set another field. If
reference counted exceptions are implemented then that might
conflict with const/immutable too (though it can be worked around
with a hashtable).
More information about the Digitalmars-d
mailing list