attribute (attribute --)
Inputs
Outputs
- None.
attribute consumes one known Text and stores it as the pending attribute specifier of the current scope. The specifier is attached to the LLVM constant of the next known Text object created in that scope, typically the next Text literal, and is then cleared. The specifier text is emitted verbatim after the constant definition, so it must be valid LLVM global-variable attribute syntax.
The builtin changes only generated code. The affected Text object stays an ordinary known Text at compile time, and no local, field, or pending declaration modifier is created by the builtin itself.
Behavior
- The pending specifier is consumed by the next known
Textobject created in the same scope. Mentioning or copying an existingTextlocal does not create an object and therefore does not consume it. - Only the first created
Textreceives the specifier: in"gamma" "delta" &the constant for"gamma"carries it, while"delta"and the concatenation result do not. - A
Textliteral that is itself the input of a followingattributealso counts as a createdTextand consumes a specifier that is still pending. - Calling
attributewhile a specifier is still pending is invalid:Attribute specifier is duplicate. - A specifier that is still pending when its scope ends is invalid:
Attribute specifier was not used. This includes a Block scope that ends without creating aText.
Example
{} 0 {} [
"section \".names\"" attribute
first: "alpha";
second: "beta";
"-- both locals are ordinary known Text values --" printCompilerMessage
first printStack _:;
second printStack _:;
0
] "main" exportFunction
Expected Output During Compilation
-- both locals are ordinary known Text values --
"alpha"
"beta"
In the generated LLVM IR only the first literal carries the specifier:
@2 = private constant [5 x i8] c"alpha", section ".names"
@3 = private constant [4 x i8] c"beta"
See also
&builtin(prefix suffix -- text)Concatenates two knownTextobjects.LFbuiltin(-- lineFeed)Pushes a line-feedTextconstant.exportFunctionbuiltin(inputsSchema output options callable name --)Exports a named function; itsoptionsdescriptor, notattribute, controls function-level settings such as the calling convention.textSizebuiltin(text -- size)Returns the UTF-8 code-unit (byte) count of aTextobject as known or unknown Natx; knownNILtext is invalid.textSplitbuiltin(text -- characterList)Splits knownTextby decoded UTF-8 characters into one-characterTextitems. Empty text yields the empty Tuple().