DConf '22: Taming Immutable Data Types in D with librebindable - Mathis Beer



Published
D 2.0 added a new const system to the language. But half of that system—immutable—still often leads to errors. That's a shame, as immutable data structures enable more reliable, readable, and testable code. However, with some limited compiler abuse, immutable can generally be made to function. Here's how.

The PDF slides are available here:
https://dconf.org/2022/slides/colvin.pdf

libRebindable dub package:
https://code.dlang.org/packages/rebindable

libRendindable on GitHub:
https://github.com/FeepingCreature/rebindable/

Documentation for `std.range.chain`:
https://dlang.org/phobos/std_range.html#chain

DConf '22 Homepage
https://dconf.org/2022/index.html

The D Programming Language Home
https://dlang.org/

#dlang #dconf #programming

TIMECODES:
00:00 Title and Introduction
00:19 Domain-Driven Design
02:47 Our traditional code vs. what we would like
06:49 Why we can't use `immutable`
08:57 Why `std.traits.Unqual` is not the solution
10:19 What actually goes wrong if you overwrite `immutable`?
14:16 Possibilities we discarded
16:48 The simplest implementation that could work
18:08 `DeepUnqual` to the rescue!
20:39 Is it secret? Is it safe?
22:59 What librebindable can do
24:39 Proposal: Referenceability is the &root of all evil
27:20 Actually viable proposal: Outright remove immutable struct fields
29:36 Conclusion
30:12 Q: Why don't we solve this at the language level?
31:15 Q: What's the problem trying to be solved here?
32:46 Q about the rvalue proposal
34:22 Q: Why put immutable on the struct declaration?
37:38 Comment about the root problem in the language
41:21 Q about an alternative approach
43:22 Q about Phobos algorithms support for const/immutable/copyable
44:54 Q about another approach
45:42 Outro
Category
Management
Be the first to comment