ChanServ changed the topic of #wayland to: https://wayland.freedesktop.org | Discussion about the Wayland protocol and its implementations, plus libinput
<kennylevinsen>
mclasen: my point was to abstract away from both rust and glib
OrkooffSep2[m] is now known as Orko[m]
<kennylevinsen>
changed the wording to help in that regard
<mclasen>
its fine, just a tangent to avoid
<kennylevinsen>
I agree
Moprius has joined #wayland
dottedmag has quit [Remote host closed the connection]
dottedmag has joined #wayland
alatiera6 has joined #wayland
rv1sr has joined #wayland
Brainium has joined #wayland
kts has quit [Quit: Konversation terminated!]
<emersion>
yeah, i don't think it was kenny's intention to compare rust and glib - on the contrary, the conmment explained how these are somewhat similar (provide unsafe funcs taking already-validated strings)
<mclasen>
ftr, the functions aren't unsafe, they simply need to be used according to their documentation
<emersion>
right, "unsafe" is rust terminology
<emersion>
(for "might blow up")
<DemiMarie>
Exactly
<mclasen>
I know
<DemiMarie>
I’d like to add enough information to the protocol XML so that libraries can validate enum values automatically.
<DemiMarie>
Right now I have code that automatically validates enum values, but it emits a wl_display.invalid_method error.
<mclasen>
does this work come with tests ?
<mclasen>
better tests would be a most useful outcome
<DemiMarie>
Not yet, and it is for ocaml-wayland, not libwayland.
<DemiMarie>
ocaml-wayland uses generated code for unmarshaling so this kind of change is much simpler
<DemiMarie>
If I add this to libwayland it will also generate an invalid_method error, unless the XML is changed to provide more information.
<DemiMarie>
There ought to be integration tests in the form of a standalone binary that can be used with any server.
<vyivel>
way-assay might be that
<mclasen>
that would be ideal
<DemiMarie>
mclasen: what do you think about automatic enum validation in and of itself?
<DemiMarie>
For tests, I think the best approach is to generate the tests from the protocol XML, but that is likely out of scope for my current project.
balrog_ has joined #wayland
balrog has quit [Ping timeout: 480 seconds]
<emersion>
DemiMarie: the wayland XML semantics is that values can live outside of the enum
<emersion>
that could be seen as a defect of the original design
<DemiMarie>
Fixable one, though: add a new attribute that specifies an error for out of range enums.
<kennylevinsen>
if the issue is that the range is not defined by the spec, how would you know if an enum is out of range?
<DemiMarie>
The presence of the new attribute would imply that the range is defined by the spec.
<kennylevinsen>
Okay, that at least does seem possible
<emersion>
yes, that would be one way to do it
<emersion>
(still unclear how that would work for foreign enums)
<kennylevinsen>
although note that some enums are bitmasks (e.g., `zwlr_layer_surface_v1::anchor`), so that's at least two different validation types
<emersion>
the auto-generated libwayland validators handle this
<kennylevinsen>
oh yeah, we have a flag for that already - nice
Brainium has quit [Quit: Konversation terminated!]
Moprius has quit [Ping timeout: 480 seconds]
Moprius has joined #wayland
bjorkint0sh has quit [Quit: "Every day, computers are making people easier to use." David Temkin]
bjorkintosh has joined #wayland
coldfeet has quit [Remote host closed the connection]
<DemiMarie>
emersion: for foreign enums my plan is to include the generated headers for the other protocols if possible
<DemiMarie>
If that is not possible, I can use extern symbols.
<emersion>
that doesn't help trying to validate them
<emersion>
foo has version 1, and an enum with entries "a", "b
<emersion>
bar references such enum
<emersion>
foo introduces v2 with a new entry "c" for the enum
<emersion>
from bar, how to validate the foo enum?
Company has joined #wayland
<DemiMarie>
Call foo's validation function?
<emersion>
with v1? or accept v2 values?
<emersion>
what if the new enum entry requires special considerations in bar?
<DemiMarie>
How is a compositor supposed to know what to do?
<emersion>
right now it's up to the protocol docs
<emersion>
and most of it is 🤷
<DemiMarie>
Any specific protocols with this problem?
<emersion>
in the most complicated instance, we'd need to define a mapping between bar's versions and accepted foo enum versions
<emersion>
or pass a version number in the bar request
<emersion>
hm, latter would not work, nvm
<emersion>
worst case, foo could have an enum entry saying "from version 2, behavior changes"
<emersion>
(wl_data_* has some of these iirc)
<emersion>
the other direction (foreign enum in an event) is also interesting
<DemiMarie>
Could this be made an error condition, with the resolution being to copy and paste the enum definition?
<emersion>
popular foreign enums are: wl_output.transform, wl_pointer.button_state, wl_pointer.axis_source, wl_pointer.axis
<emersion>
well, i think it's a bit late for that
<emersion>
since it's a pretty widely used feature
<DemiMarie>
Could the existing ones be special-cased in the scanner?
<DemiMarie>
More generally, is the XML meant to include semantics or just the wire format?
<kennylevinsen>
Hmm? The XML specs define high-level messages and their semantics, not wire format
<DemiMarie>
I'm wondering if I am trying to do too much.
<soreau>
less is the new more
<kennylevinsen>
as `man 1 more` states, "Users should realize that less provides more"
<DemiMarie>
soreau kennylevinsen: are you joking or being serious?
<kennylevinsen>
I’m just quoting the man page
<kennylevinsen>
But it might seem like you’re trying to fight an uphill battle - adding the foreign enum flag and then skipping all validation of that, checking just the range of “normal” enums could be a simplification
<kennylevinsen>
Foreign enums are special regardless
<emersion>
Kenny follows man pages for all important life decisions
___nick___ has joined #wayland
<kennylevinsen>
When I have a kid, I’ll hand them the command-line “man man” and consider my job raising them done
kts has joined #wayland
<emersion>
rtfm education
<soreau>
I'll teach mine to rtfs :P
<kennylevinsen>
DemiMarie: you can also consider if invalid enums is enough of an issue to bother with at all of course - the problem is much smaller than the utf8 validity thing, yet more annoying to implement
coldfeet has joined #wayland
<kennylevinsen>
Your time has value, so spend it wisely
coldfeet has quit [Remote host closed the connection]
___nick___ has quit []
___nick___ has joined #wayland
___nick___ has quit []
leon-anavi has quit [Remote host closed the connection]
Moprius has quit [Quit: bye]
tzimmermann has quit [Quit: Leaving]
___nick___ has joined #wayland
mclasen is now known as mclasen_afk
mohit8158226353 has quit [Remote host closed the connection]
rasterman has joined #wayland
kts has quit [Quit: Konversation terminated!]
mohit8158226353 has joined #wayland
mohit81582263530 has joined #wayland
paulk-bis has quit []
paulk has joined #wayland
mohit8158226353 has quit [Ping timeout: 480 seconds]
mohit81582263530 has quit [Ping timeout: 480 seconds]
mohit81582263530 has joined #wayland
mohit81582263530 has quit []
gryffus has joined #wayland
mohit81582263530 has joined #wayland
mohit81582263530 has quit []
mohit81582263530 has joined #wayland
gryffus_ has joined #wayland
gryffus has quit [Ping timeout: 480 seconds]
lyudess has quit []
Lyude has joined #wayland
feaneron has quit [Ping timeout: 480 seconds]
coldfeet has joined #wayland
rasterman has quit [Quit: Gettin' stinky!]
Moprius has joined #wayland
Brainium has joined #wayland
coldfeet has quit [Remote host closed the connection]
naemi44915 has quit []
naemi44915 has joined #wayland
___nick___ has quit [Remote host closed the connection]
Brainium has quit [Remote host closed the connection]
iconoclasthero has joined #wayland
Moprius has quit [Quit: bye]
ity has joined #wayland
<daniels>
DemiMarie: the XML doesn't try to encode every possible error condition - for instance, trying to make a toplevel from a surface that's also a subsurface is described as being erroneous in text, but not in XML