The standard library of the D programming language
Find a file
Inkrementator 3a8f31acbd
Fix #9811 Remove const from Tuple.toString (#10646)
Now, member structs won't become const due to transitiveness and the
code in `std.format` can choose (erroneously) non-cost toString()
functions of member structs.

An expert has to decide whether this is worth the breaking change. Now,
code that uses `const` tuples and calls toString directly on them will
break. Alternatively, we could use
[Template this parameters](https://dlang.org/spec/template.html#template_this_parameter).

That way, we get a template parameter with the real type of this. Then we can
cast away constness of `this` when we now for certain that it isn't,
since `is(T != typeof(this))` (where T is the template this parameter).
Of course, this implies making toString `@trusted` too.

This might also lead to unforeseen bugs when `const` is cast away but
the member objects are actually const. I'm not sure how this works.

Fwiw, currently std.format and `std.conv: to` already intercepts const tuples,
thus it at least won't call toString directly. The breaking change will
only effect code that calls toString on const tuples directly.

That's why I have added non-prescritive tests. If something in
std.format changes, they'll be alerted and can then decide whether to
change the tests or whether this module also needs work, in case this
would lead a bigger breaking change.

Followup to #10645.
2025-02-22 09:25:20 +08:00
.circleci Merge Makefiles 2023-12-16 22:22:20 +01:00
.github/workflows GHA main: Add Alpine Linux job, to CI-test musl libc (#10632) 2025-01-28 03:00:59 +01:00
changelog Add SharedAllocatorList (#10594) 2024-12-27 11:40:08 +08:00
etc/c Remove unused import (#10571) 2024-12-06 17:27:44 -08:00
phobos Add phobos.sys.traits.hasIndirections. (#10634) 2025-02-07 08:20:22 -08:00
std Fix #9811 Remove const from Tuple.toString (#10646) 2025-02-22 09:25:20 +08:00
test Add sumtype to Phobos (#7702) 2021-03-05 12:41:34 +01:00
tools Update to unicode 16.0.0 (#9058) 2024-10-16 06:24:56 +08:00
.codecov.yml yaml: make files comply with YAML specification 2021-08-30 14:54:57 +00:00
.dscanner.ini Silence buildkite style failure on std.range 2024-07-31 15:25:37 +02:00
.editorconfig Fix line endings in .editorconfig 2018-09-16 12:19:04 -07:00
.gitignore Remove Phobos 3 dub.sdl and replace it with the build_v3.d build script. (#9069) 2024-10-25 17:49:41 -07:00
build_v3.d Remove Phobos 3 dub.sdl and replace it with the build_v3.d build script. (#9069) 2024-10-25 17:49:41 -07:00
CODEOWNERS Update CODEOWNERS to reflect that logger has been moved out of std.experimental (#10608) 2025-01-02 10:11:36 +08:00
CONTRIBUTING.md Remove bugzilla references 2024-12-01 23:23:23 +01:00
index.dd Remove deprecated std.xml module 2022-08-28 11:30:15 +02:00
LICENSE_1_0.txt Changed Phobos to use the Boost license. Currently, all public domain modules and all licensed modules by Walter, Andrei, Bartosz, and Don have been changed to use this license (excepting std.c, for the moment). Ideally, all Phobos modules will eventually be distributed under this license, which means obtaining permission from a few more authors, deleting, or rewriting some modules. 2009-09-16 18:19:51 +00:00
Makefile Remove -de switch from Phobos builds to allow deprecations. 2024-09-20 15:06:49 +02:00
posix.mak Restore posix.mak, forwarding to generic Makefile 2023-12-16 22:22:20 +01:00
project.ddoc add PROJECT=phobos ddoc macro 2014-01-10 19:16:53 +01:00
README.md Remove bugzilla references 2024-12-01 23:23:23 +01:00
unittest.d Remove deprecated symbols from std.digest.digest 2020-04-09 11:35:23 +02:00

D Logo Phobos Standard Library

GitHub tag CircleCi Buildkite Code coverage license

Phobos is the standard library that comes with the D Programming Language Compiler.

Download

Phobos is packaged together with the compiler. You should download the whole precompiled package.

To build everything yourself, there is a description in the wiki.

Phobos is distributed under Boost Software Licence. See the licence file.

I Want to Contribute

Great! See the CONTRIBUTING.md file.