Language Change Specification for Function Knows Vector Size

LCS Number: LCS-2016-072b
Version: 18
Date: 23-Mar-2017
Status: Voting
Authors: Kevin Jennings, Martin Zabel, Jim Lewis, and Patrick Lehmann
Source Doc: FunctionKnowsVectorSize
History Doc: History
Derived from and conflicts with: LCS_2016_072

Style Notes

Changes are shown in red font. Deletions are crossed out. Editing notes in green font.

Details of Language Change

LRM 4.1 General (of Subprograms and packages)

72b.1: Page 19 edit second paragraph

There are two forms of subprograms: procedures and functions. A procedure call is a statement; a function call is an expression and returns a value. Certain functions, designated pure functions, return the same value each time they are called with the same values as actual parameters; the remainder, impure functions, may return a different value each time they are called, even when multiple calls have the same actual parameter values. For the purposes of determining purity, the return identifier of a function is considered a parameter. In addition, impure functions can update objects outside of their scope and can access a broader class of values than can pure functions. The definition of a subprogram can be given in two parts: a subprogram declaration defining its calling conventions, and a subprogram body defining its execution.

LRM 4.2.1 General (Subprogram declarations)

72b.2: Page 19 near bottom and page 487


  function_specification ::=
      [ pure | impure ] function designator
      subprogram_header
      [ [ parameter ] ( formal_parameter_list ) ] return [ return_identifier of ] type_mark

72b.3: Page 20 edit first paragraph

The specification of a procedure specifies its designator, its generics (if any), and its formal parameters (if any). The specification of a function specifies its designator, its generics (if any), its formal parameters (if any), its return identifier (if any), the subtype of the returned value (the result subtype), and whether or not the function is pure. A function is impure if its specification contains the reserved word impure; otherwise, it is said to be pure. A procedure designator is always an identifier. A function designator is either an identifier or an operator symbol. A designator that is an operator symbol is used for the overloading of an operator (see 4.5.2). The sequence of characters represented by an operator symbol shall be an operator belonging to one of the classes of operators defined in 9.2. Extra spaces are not allowed in an operator symbol, and the case of letters is not significant.

72b.4-1: Page 20 Add after the first paragraph

For a function that includes a return identifier, an implicit subtype declaration, whose name is the return identifier, is created as the first declaration in the subprogram declarative part. The properties of the implicitly declared subtype denoted by the return identifier shall be determined from the immediate context of a the funciton call, as follows:

72b.4-2: Page 20 edit to list item a

a) If the function call is the expression following the assignment symbol ":=" in a constant, variable, or signal declaration, then the subtype denoted by the return identifier is the subtype of the corresponding object declaration.

72b.4-3: Page 20 edit to list item b

b) If the function call is the value expression in an assignment statement whose target is not an aggregate, then the subtype denoted by the return identifier is the subtype of the target of the assignment statement.

72b.4-4: Page 20 edit to list item c

c) If the function call is the actual in an association element, then the subtype denoted by the return identifier is the subtype of the corresponding formal.

72b.4-5: Page 20 edit to list item d

d) If the function call is the formal in an association element, then the subtype denoted by the return identifier is the subtype of the corresponding actual.

72b.4-6: Page 20 edit to list item e

e) If the function call is the operand in a qualified expression, then the subtype denoted by the return identifier is the subtype defined by the type mark of the qualified expression.

72b.4-6: Page 20 next paragraph

It is an error if a function has a return identifier and
  • the function is called from a context other than the ones above.
  • the subtype of the return identifier is a unconstrained or partially constrained composite subtype.



Comments

Topic revision: r20 - 2017-07-22 - 17:43:49 - JimLewis
 
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback