Glossary - D Programming Language
Description: D Programming Language
Keywords: D programming language

Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
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 using a local clone.

# Glossary

BLIT (Block Transfer)
  Also known as BLT, blit refers to copying memory byte for byte. In C, this is referred to as a memcpy operation. The name originated with the BLT instruction on the DEC PDP-10 computer.
CTFE (Compile Time Function Evaluation)
  Refers to the ability to execute regular D functions at compile time rather than at run time.
code point
  In Unicode terminology, a code point is a logical character. The range of code points is 0 through 0x10FFFF. Only dchars can store code points directly; arrays of char and wchar need to use the variable-length encodings UTF-8 and UTF-16.
COW (Copy On Write)
  COW is a memory management strategy where (usually large) reference objects are copied if they are to be modified. The constant overhead of COW can be high, but may be preferable in applications that would otherwise do a lot of preemptive copying.
Data Race
  Two or more threads writing to the same memory location. Program behavior may depend on the arbitrary sequencing of these memory accesses.
Functor
  A user-defined type (struct or class) that defines the function call operator (opCall in D) so it can be used similarly to a function.
GC (Garbage Collection)
  Garbage collection is the common name for the term automatic memory management. Memory can be allocated and used, and the GC will automatically free any chunks of memory no longer referred to. In contrast, explicit memory management is where the programmer must carefully match up each allocation with one and only one call to free().
Higher-order function
  A function that either accepts another function as a parameter, returns a function, or both.
IFTI (Implicit Function Template Instantiation)
  Refers to the ability to instantiate a template function without having to explicitly pass in the types to the template. Instead, the types are inferred automatically from the types of the runtime arguments. See spec for details.
Illegal
  A code construct is illegal if it does not conform to the D language specification. This may be true even if the compiler or runtime fails to detect the error.
Input range
  A type (i.e., a struct or a class) that defines the member functions empty, head, and next. Input ranges are assumed to be strictly one-pass: there is no way to save the state of the iteration in a copy of the range. See also range.
Implementation Defined Behavior
  This is variation in behavior of the D language in a manner that is up to the implementor of the language. An example of implementation defined behavior would be the size in bytes of a pointer: on a 32 bit machine it would be 4 bytes, on a 64 bit machine it would be 8 bytes. Minimizing implementation defined behavior in the language will maximize the portability of code.
lvalue
  An lvalue is an abstract term referring to a value with an accessible address (through e.g. the unary & operator). Typical examples of lvalues include variables, constants introduced with const or immutable (but not enum), and elements of arrays and associative arrays. Calls to functions that return ref and pointer dereference expressions are also lvalues. Lvalues can be passed to (or be returned from) functions by reference. An lvalue is the counterpart to an rvalue.
NRVO (Named Return Value Optimization)

  NRVO is a technique invented by Walter Bright around 1991 (the term for it was coined later) to minimize copying of struct data. Functions normally return their function return values in registers. For structs, however, they often are too big to fit in registers. The usual solution to this is to pass to the function a hidden pointer to a struct instance in the caller's stack frame, and the return value is copied there. For example:

      struct S { int a, b, c, d; }

      S foo()
      {
          S result;
          result.a = 3;
          return result;
      }

      void test()
      {
          S s = foo();
      }

  is rewritten as:

      S* foo(S* hidden)
      {
          S result;
          result.a = 3;
          *hidden = result;
          return hidden;
      }

      void test()
      {
          S tmp;
          S s = *foo(&tmp);
      }

  This rewrite gives us an extra temporary object tmp, and copies the struct contents twice. What NRVO does is recognize that the sole purpose of result is to provide a return value, and so all references to result can be replaced with *hidden. foo is then rewritten as:

      S* foo(S* hidden)
      {
          hidden.a = 3;
          return hidden;
      }

  A further optimization is done on the call to foo to eliminate the other copy, giving:

      void test()
      {
          S s;
          foo(&s);
      }

  The result is written directly into the destination s, instead of passing through two other instances.

narrow strings
  All arrays that use char, wchar, and their qualified versions are narrow strings. (Those include string and wstring). Range-oriented functions in the standard library handle narrow strings specially by automatically decoding the UTF-encoded characters.
opApply
  A special member function used to iterate over a collection; this is used by the ForeachStatement.
opApplyReverse
  A special member function used to iterate over a collection in the reverse order; this is used by the ForeachStatement.
POD (Plain Old Data)
  Refers to a struct that contains no hidden members, does not have virtual functions, does not inherit, has no destructor, and can be initialized and copied via simple bit copies.
Predicate
  A function or delegate returning a Boolean result. Predicates can be nullary (take no arguments), unary (take one argument), binary (take two arguments), or n-ary (take n arguments). Usually predicates are mentioned within the context of higher-order functions, which accept predicates as parameters.
qualifier-convertible
  A type T is qualifer-convertible to type U if and only if they only differ in qualifiers and if a reference to T can be implicitly converted to a reference to U per the language rules.
RAII (Resource Acquisition Is Initialization)
  RAII refers to the technique of having the destructor of a class object called when the object goes out of scope. The destructor then releases any resources acquired by that object. RAII is commonly used for resources that are in short supply or that must have a predictable point when they are released. RAII objects in D are created using the scope storage class.
rvalue
  An rvalue is an abstract term referring to a value resulting from an expression that has no accessible memory address. This lack of address is only conceptual; the implementation has the liberty to store an rvalue in addressable memory. Rvalues cannot be changed and cannot be passed to (or be returned from) functions by reference. An rvalue is the counterpart to an lvalue.
Sequential Consistency
  Data being written in one order in one thread being visible in the same order to another thread.
SFINAE (Substitution Failure Is Not An Error)
  If template argument deduction results in a type that is not valid, that specialization of the template is not considered further. It is not a compile error. See also SFINAE.
TMP (Template Metaprogramming)
  TMP is using the template features of the language to execute programs at compile time rather than runtime.
TLS (Thread Local Storage)
  TLS allocates each thread its own instance of the global data. See also Wikipedia.
UB (Undefined Behavior)
  Undefined behavior happens when an illegal code construct is executed. Undefined behavior can include random, erratic results, crashes, faulting, etc. A buffer overflow is an example of undefined behavior.
UDA (User-Defined Attribute)
  User-defined attributes are metadata attached to symbols used for compile-time reflection.
UFCS (Uniform Function Call Syntax)
  Uniform function call syntax refers to the ability to call a function as if it were a method of its first argument. For example funct(arg) may be written as arg.funct().

Copyright © 1999-2021 by the D Language Foundation | Page generated by Ddoc on Mon Aug 9 19:46:52 2021