<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Add enum attribute to arg element to allow type safe protocol generation for languages that support enum as a type."
href="https://bugs.freedesktop.org/show_bug.cgi?id=82127">82127</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>wayland-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>Add enum attribute to arg element to allow type safe protocol generation for languages that support enum as a type.
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Reporter</th>
<td>derijcke.erik@gmail.com
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Component</th>
<td>wayland
</td>
</tr>
<tr>
<th>Product</th>
<td>Wayland
</td>
</tr></table>
<p>
<div>
<pre>Note that this suggestion is not the same as the one proposed in <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED NOTABUG - [task] Protocol: Make enums a type for arguments"
href="show_bug.cgi?id=55534">bug 55534</a>.
Currently the protocol defines enums but does not specify any means of
assigning those enums to arguments. The only way to deduce this is to read the
documentation and hope you get it right.
This is ok if you're programming in C.
However a lot of other languages have a separate enum type that allows for type
safe input of arguments that expect it. Unfortunately the wayland protocol xml
does not link arguments that expect an enum value to the respective enum,
making it impossible for these languages to fully facilitate their typesafe
nature.
I propose to add an "enum" attribute to a "arg" elements that expect an enum.
The value of the "enum" attribute will be the "name" value of the required
"enum" element. This way the current C generator will not be impacted while
allowing typesafe languages to use this extra piece of information.
example:
<enum name="error">
...
</enum>
<arg name="code" type="uint" enum="error"/></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>