Movatterモバイル変換


[0]ホーム

URL:


D Logo
Menu
Search

Language Reference

table of contents

Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinga local clone.

Editions

Contents
  1. Grammar

Editions provide a way to evolve D by obsoletingfeatures while maintaining compatibility with code that uses thosefeatures. Editions are a module level feature, i.e. various sectionsof a module cannot be set to different editions.

The edition is set either by default, by putting it in theModuleDeclaration,or with the-edition command line switch.

Editions are meant to be backwards and forwards compatible; it makes it possible for a Dmodule targeting one edition to import a D module targeting any other edition.A template must obey the rules of the edition targeted by the module in which itis defined, not the module in which it is instantiated. Compatibility is at thesource code level; no promises of ABI compatibility are made. All code, old andnew, must be compiled with the same version of the compiler. Only one versionof DRuntime, which must support all existing editions, is to be provided with a compiler release.

Grammar

Edition:DecimalInteger

What can editions do?

Specifying the Edition

An edition level is determined by:

  1. an explicit 4 digit number corresponding to the year in which the desired edition was released
  2. if no edition is specified, and there is noModuleDeclaration in the source code,the edition used is theBaseline Edition, which corresponds to 2023.
  3. if no edition is specified, and there is aModuleDeclaration in the source code,the edition used is the year the compiler was released.
Legacy Code
Copyright © 1999-2026 by theD Language Foundation | Page generated byDdoc on Fri Feb 20 12:53:11 2026

[8]ページ先頭

©2009-2026 Movatter.jp