<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.visual-prolog.com/index.php?action=history&amp;feed=atom&amp;title=Program_Defined_Attributes</id>
	<title>Program Defined Attributes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.visual-prolog.com/index.php?action=history&amp;feed=atom&amp;title=Program_Defined_Attributes"/>
	<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Program_Defined_Attributes&amp;action=history"/>
	<updated>2026-05-15T01:34:27Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Program_Defined_Attributes&amp;diff=4606&amp;oldid=prev</id>
		<title>Thomas Linder Puls: release</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Program_Defined_Attributes&amp;diff=4606&amp;oldid=prev"/>
		<updated>2019-03-12T16:13:39Z</updated>

		<summary type="html">&lt;p&gt;release&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:13, 12 March 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Template:NonReleased}}&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This section describes how to define attributes that can be written on entities in a program.  Currently, the attributes will not have any semantics influence nor can they be accessed through reflection, so they will only be accessible to tools that parse the code itself.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This section describes how to define attributes that can be written on entities in a program.  Currently, the attributes will not have any semantics influence nor can they be accessed through reflection, so they will only be accessible to tools that parse the code itself.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Thomas Linder Puls</name></author>
	</entry>
	<entry>
		<id>https://wiki.visual-prolog.com/index.php?title=Program_Defined_Attributes&amp;diff=4553&amp;oldid=prev</id>
		<title>Thomas Linder Puls: initial version</title>
		<link rel="alternate" type="text/html" href="https://wiki.visual-prolog.com/index.php?title=Program_Defined_Attributes&amp;diff=4553&amp;oldid=prev"/>
		<updated>2019-02-13T13:15:56Z</updated>

		<summary type="html">&lt;p&gt;initial version&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Template:NonReleased}}&lt;br /&gt;
&lt;br /&gt;
This section describes how to define attributes that can be written on entities in a program.  Currently, the attributes will not have any semantics influence nor can they be accessed through reflection, so they will only be accessible to tools that parse the code itself.&lt;br /&gt;
&lt;br /&gt;
{{Example|1=As an example consider the use of the attributes &amp;lt;vp&amp;gt;meta&amp;lt;/vp&amp;gt; and &amp;lt;vp&amp;gt;metaDisplayAs&amp;lt;/vp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;&lt;br /&gt;
interface person supports personGenerated&lt;br /&gt;
    [meta]&lt;br /&gt;
&lt;br /&gt;
properties&lt;br /&gt;
    name : string [meta].&lt;br /&gt;
    address : string [metaDisplayAs(&amp;quot;address&amp;quot;)].&lt;br /&gt;
&lt;br /&gt;
end interface person&lt;br /&gt;
&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The basic idea is that an external tool parses the file (in an external step) and based on the code and the meta attributes generates the interface (+ class + implementation) &amp;lt;vp&amp;gt;personGenerated&amp;lt;/vp&amp;gt;.  The exact contents of the generated class is not relevant for this example; the important thing is that the attributes are used to define what should be generated and how it should function.&lt;br /&gt;
}}&lt;br /&gt;
 &lt;br /&gt;
Without any further action the compiler will generate warnings for the attributes above.  To avoid this the attributes can be defined in a functor domain which is given the attribute &amp;lt;vp&amp;gt;attribute&amp;lt;/vp&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;&lt;br /&gt;
namespace ns&lt;br /&gt;
&lt;br /&gt;
interface meta&lt;br /&gt;
&lt;br /&gt;
domains&lt;br /&gt;
    meta =&lt;br /&gt;
        meta;&lt;br /&gt;
        metaDisplayAs(string DisplayAs) [attribute].&lt;br /&gt;
&lt;br /&gt;
end interface meta&lt;br /&gt;
&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that the attributes are both in a namespace and a scope.&lt;br /&gt;
&lt;br /&gt;
Using normal rules that will handle name conflicts.  On the other hand the &amp;lt;vp&amp;gt;person&amp;lt;/vp&amp;gt; interface will use to qualified attributes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;&lt;br /&gt;
interface person supports personGenerated&lt;br /&gt;
    [ns\meta::meta]&lt;br /&gt;
&lt;br /&gt;
properties&lt;br /&gt;
    name : string [ns\meta::meta].&lt;br /&gt;
    address : string [ns\meta::metaDisplayAs(&amp;quot;address&amp;quot;)].&lt;br /&gt;
&lt;br /&gt;
end interface person&lt;br /&gt;
&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The qualification can be omitted by opening the scope &lt;br /&gt;
&lt;br /&gt;
&amp;lt;vip&amp;gt;&lt;br /&gt;
interface person supports personGenerated&lt;br /&gt;
    open ns\meta&lt;br /&gt;
    [meta]&lt;br /&gt;
&lt;br /&gt;
properties&lt;br /&gt;
    name : string [meta].&lt;br /&gt;
    address : string [metaDisplayAs(&amp;quot;address&amp;quot;)].&lt;br /&gt;
&lt;br /&gt;
end interface person&lt;br /&gt;
&amp;lt;/vip&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Given this the compiler will:&lt;br /&gt;
&lt;br /&gt;
* suppress the w193 warning (for unknown attribute)&lt;br /&gt;
* resolve ambiguities (when everybody want to use &amp;lt;vp&amp;gt;meta&amp;lt;/vp&amp;gt; and &amp;lt;vp&amp;gt;test&amp;lt;/vp&amp;gt; as attribute names)&lt;br /&gt;
* type check the attributes&lt;br /&gt;
&lt;br /&gt;
The attributes will have to follow the rules for (compile time computable) constants (i.e. cannot contain function and predicate calls).&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Thomas Linder Puls</name></author>
	</entry>
</feed>