Changes from the upstream D Language
OpenD forked off upstream D on January 1, 2024. Since then, some things have diverged. This page lists the differences.
Items are tagged [parser] if it had a parser change, [library] if a library change, and [experimental] if it is still subject to further major change at this time.
Additions
- [parser] Interpolated expression sequences added
- 0o777 octal literals added
- `version(D_OpenD)` is defined to identify the forked compiler
- `__traits(docComment, symbol)` is added to get the ddoc comment attached to a symbol
- opUnaryRight, enables overriding the default behavior for post increment and post decrement
- [library] Atomic!T, an atomic type similar to what is provided with std::atomic in C++
- [parser] [experimental] You can name unittests with `unittest "your name" { ... }`
- [experimental] `opImplicitCast` added, which allows implicit conversions on function parameter passing or direct assignments to arbitrary types.
- `@implicit this()` constructors added, which allows implicit construction when passing arguments to functions.
- [parser] `private(this)` added for class-level private
- `-unittest=x` can take module patterns
- `pragma(explicit_gc)` implemented
- `ref` on locals implemented
- string file imports now implicitly cast to byte arrays
- `import()` expressions can now, by default, load files from the defining module's source directory
- pragma(linkerDirective) and @section now work on dmd similarly to ldc
- extern(Objective-C) works on ldc similarly to dmd
Changes
- If a module is imported, it must have a module declaration at the top of the file, and it must match the import name.
- Files with invalid identifier chars might be modified to make a working anonymous name if and only if they are a top-level module, not imported by other things
- Bug fix for extern(C++) multiple inheritance merged (possibly regression causing but passes all tests so far
- `-preview=bitfields` is not supported. C style bitfields are a mistake to copy into D. You can still use them with C code (including with the importC feature).
- `==` is supported with `null` and classes
- Interpolated expression sequences allow `$ident` in addition to `$(expr)`. Some code that uses `$thing` in one of these may now have to escape the `$`.
- `-preview=systemVariables` is enabled by default.
- Several safe warnings are enabled by default
Packaging
- The dmd, druntime, phobos, and ldc repos are all merged to reduce duplicated work. The opend releases include both dmd and ldc, where dmd is supported.
- dub, reggae, and rdmd are not packaged with OpenD. If you depend on them, the upstream versions should work if you use the `--compiler` option to them.
Things upstream added after OpenD
Interpolated expression sequences are now upstream.
Upstream is looking at our safer by default changes too.
Notes about OpenD docs that need writing
The implicit casts should generally only be used if they are always correct. So implicit convert only if the type being converted is ALWAYS valid as the one converting to; it must be a superset when considering storage and invariants. Same on the implicit construct, just the other way.