www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Referencing chapters from the language specification in code.

reply Iain Buclaw via Digitalmars-d <digitalmars-d puremagic.com> writes:
Hi,

I have my own conclusions with doing the following, but I'd thought
I'd ask for a second opinion before committing.

Given the freely available language specification linked below [1].
The order that all entries are listed in haven't changed since D1, or
at least to my memory.  So would it be considered reasonably safe to
reference these parts in code?

As an example, where the part in [square brackets] is the chapter reference.

  /* [12.12 Array Bounds Checking]:
     If an index is out of bounds, a RangeError exception is raised
     if detected at runtime.
     [...]
     Insertion of array bounds checking code at runtime should be
     turned on and off with a compile time switch.  */
  if (flag_array_bounds)
  {
    <compiler code that generates array bounds checking here>
  }

Or is there a more suitably stable reference I that can be used in
place of the dlang site?  In the process of increasing code
documentation of the internals of GDC, what I'd also like to
eventually end up with are justifications at each point for why the
compiler generates what it does.

Regards
Iain

[1]: http://dlang.org/dlangspec.pdf
Jul 24 2016
parent Walter Bright <newshound2 digitalmars.com> writes:
On 7/24/2016 10:10 AM, Iain Buclaw via Digitalmars-d wrote:
 Given the freely available language specification linked below [1].
 The order that all entries are listed in haven't changed since D1, or
 at least to my memory.  So would it be considered reasonably safe to
 reference these parts in code?
Yes. I'd even use clickable URLs. And yes, the URLs and locations in the spec may change. I don't think this is a big problem, though. Worst case is having to eventually update the code URL.
Jul 24 2016