Difference between revisions of "Language Reference/Attributes"

From wiki.visual-prolog.com
(Initial)
(No difference)

Revision as of 16:29, 15 March 2010

Various declarations can be annotated with attributes. This section describes the general syntax of attributes and where they can be placed. It also describes the meaning of the specific attributes.

Attributes :
    [ Attribute-comma-sep-list ]
Attribute : one of
    LowerCaseIdentifier
    LowerCaseIdentifier ( Literal-comma-sep-list )

Where the literals must either be numbers or string literals.

deprecated

The declared entity is deprecated the string literal describes how to migrate from it. The entity still exist, but usage will cause a warning. The entity will not exist in future versions of Visual Prolog.

Example
predicates
    oldFasioned : (string Arg) [deprecated("Use newFasion instead")].

retired

The declared entity is retired the string literal describes how to migrate from it. The entity does not exist anymore.

Example
predicates
    veryOldFasioned : (string Arg) [retired("Use newFasion instead")].

inline

inline alters the memory layout of a struct (i.e. a single alternative functor domain with an align qualification). The corresponding field is inlined instead of being pointed to.

Example
domains
    point = align 4 
        p(integer X, integer Y).
 
domains
    rectangle = align 4
        r(
            point UpperLeft [inline],
            point LowerRight [inline]
        ).


It is also possible to inline fixed size string and string8 fields in structs:

Example
domains
    device = align 4
        device(
            integer Id,
            string DeviceName [inline(32)]
        ).