[yast-devel] Where is '`id()' documented?
Hello, I cannot find where `id() is documented, i.e. what exactly does this symbol do in particular regarding UI functions. I am confused because http://forgeftp.novell.com/yast/doc/SL11.1/tdg/id_ycp_data_symbol.html reads "A symbol is a literal constant". In contrast http://forgeftp.novell.com/yast/doc/SL11.1/tdg/ChangeWidget.html reads "symbol widgetId Can also be specified as `id( any widgetId )" Therefore for example in UI::ChangeWidget(`id("widget_id_string"),... the literal constant `id("widget_id_string") seems to be more like a function call of a function named id with prototype/signature symbol id ( any ) but I cannot even find such a function documented. I use and used `id() by "look at other code" all the time but now I have the strange idea to try to understand it ;-) In particular I wonder why UI::whatever_widget_function(`id(`widget_id_symbol),... is used most often in YCP code instead of simply calling UI::whatever_widget_function(`widget_id_symbol,... which is also (less often) used in YCP code. For me `id(`widget_id_symbol) looks like a useless "call" of a symbol->symbol conversion. Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany AG Nuernberg, HRB 16746, GF: Markus Rex -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On Thu, Jan 21, 2010 at 12:34:54PM +0100, Johannes Meixner wrote:
I cannot find where `id() is documented, i.e. what exactly does this symbol do in particular regarding UI functions.
I am confused because http://forgeftp.novell.com/yast/doc/SL11.1/tdg/id_ycp_data_symbol.html reads "A symbol is a literal constant".
In contrast http://forgeftp.novell.com/yast/doc/SL11.1/tdg/ChangeWidget.html reads "symbol widgetId Can also be specified as `id( any widgetId )"
The ChangeWidget documentation is incomplete. It is true that the ID can be specified as `foo or `id(bar), where bar is of any type, but the function prototype wrongly restricts the argument type to a symbol.
Therefore for example in UI::ChangeWidget(`id("widget_id_string"),... the literal constant `id("widget_id_string") seems to be more like a function call of a function named id with prototype/signature symbol id ( any ) but I cannot even find such a function documented.
I use and used `id() by "look at other code" all the time but now I have the strange idea to try to understand it ;-)
In particular I wonder why UI::whatever_widget_function(`id(`widget_id_symbol),... is used most often in YCP code instead of simply calling UI::whatever_widget_function(`widget_id_symbol,... which is also (less often) used in YCP code.
For me `id(`widget_id_symbol) looks like a useless "call" of a symbol->symbol conversion.
`id is a term, not a function call. If the ID is a symbol, you can say `foo or `id(`foo), where the latter is preferred for consistency. -- Martin Vidner, YaST developer http://en.opensuse.org/User:Mvidner Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dne 22.1.2010 09:48, Martin Vidner napsal(a):
On Thu, Jan 21, 2010 at 12:34:54PM +0100, Johannes Meixner wrote:
I cannot find where `id() is documented, i.e. what exactly does this symbol do in particular regarding UI functions.
I am confused because http://forgeftp.novell.com/yast/doc/SL11.1/tdg/id_ycp_data_symbol.html reads "A symbol is a literal constant".
In contrast http://forgeftp.novell.com/yast/doc/SL11.1/tdg/ChangeWidget.html reads "symbol widgetId Can also be specified as `id( any widgetId )"
The ChangeWidget documentation is incomplete. It is true that the ID can be specified as `foo or `id(bar), where bar is of any type, but the function prototype wrongly restricts the argument type to a symbol.
YaST documentation is in SVN and everyone (with write access) can extend it. Please, do so. Yes, you can :) The base repository is here (trunk or branches): http://svn.opensuse.org/svn/yast/trunk/doc/ The rest is generated from code and/or code documentation in respective module. Bye Lukas -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/ iD8DBQFLWXO+VSqMdRCqTiwRAhlmAJwI1oqco5K/LyXj8Od/fgeN57j8WwCfSL5b OAtJFysZqJw6b7szCo7swiY= =ytei -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
Hello, On Jan 22 10:45 Lukas Ocilka wrote:
Dne 22.1.2010 09:48, Martin Vidner napsal(a):
On Thu, Jan 21, 2010 at 12:34:54PM +0100, Johannes Meixner wrote:
I cannot find where `id() is documented, i.e. what exactly does this symbol do in particular regarding UI functions.
I am confused because http://forgeftp.novell.com/yast/doc/SL11.1/tdg/id_ycp_data_symbol.html reads "A symbol is a literal constant".
In contrast http://forgeftp.novell.com/yast/doc/SL11.1/tdg/ChangeWidget.html reads "symbol widgetId Can also be specified as `id( any widgetId )"
The ChangeWidget documentation is incomplete. It is true that the ID can be specified as `foo or `id(bar), where bar is of any type, but the function prototype wrongly restricts the argument type to a symbol.
YaST documentation is in SVN and everyone (with write access) can extend it. Please, do so. Yes, you can :)
The base repository is here (trunk or branches): http://svn.opensuse.org/svn/yast/trunk/doc/
The rest is generated from code and/or code documentation in respective module.
By the way: I like to report now what else in the UI functions documentation confuses me all the time. For example see http://forgeftp.novell.com/yast/doc/SL11.1/tdg/PushButton.html The PushButton "function" prototype (actually it is a term prototype) is PushButton ( string iconName, string label ) but the examples below "call" (one cannot call a term) it as `PushButton( `id( `click ), `opt( `default, `hstretch ), "Click me" ) and as `PushButton( "&OK" ) which all contradict the prototype.
From the examples I guess the prototype might be something like PushButton ( string label ) PushButton ( term ID, string label ) PushButton ( term options, string label ) PushButton ( term ID, term options, string label )
But now I am again confused because PushButton ( term ID, string label ) PushButton ( term options, string label ) have the same signature (term, string) so that I wonder how the heck the UI can distinguish if `PushButton( `foo, "Click me" ) actually means `PushButton( `id( `foo ), "Click me" ) or `PushButton( `opt( `foo ), "Click me" ) Therefore I guess that the symbol value `id or `opt of the term makes the difference so that the actual prototype is something like `PushButton ( string ) `PushButton ( symbol, string ) `PushButton ( `id( any ), string ) `PushButton ( `opt( symbol, symbol,... ), string ) `PushButton ( symbol, `opt( symbol, symbol,... ), string ) `PushButton ( `id( any ), `opt( symbol, symbol,... ), string ) But even now it is still left as exercise to the reader to find out what actually is supported as "any" widget ID ;-) Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany AG Nuernberg, HRB 16746, GF: Markus Rex -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
Hello, On Jan 22 09:48 Martin Vidner wrote:
On Thu, Jan 21, 2010 at 12:34:54PM +0100, Johannes Meixner wrote:
I cannot find where `id() is documented, i.e. what exactly does this symbol do in particular regarding UI functions.
I am confused because http://forgeftp.novell.com/yast/doc/SL11.1/tdg/id_ycp_data_symbol.html reads "A symbol is a literal constant".
In contrast http://forgeftp.novell.com/yast/doc/SL11.1/tdg/ChangeWidget.html reads "symbol widgetId Can also be specified as `id( any widgetId )"
The ChangeWidget documentation is incomplete. It is true that the ID can be specified as `foo or `id(bar), where bar is of any type, but the function prototype wrongly restricts the argument type to a symbol.
Thanks a lot! This was what leads to my confusion because `id( any widgetId ) is actually not of type symbol but of type term which contradicts the documented function prototype for ChangeWidget. Actually most (perhaps all) other UI widget function documentation are even more incomplete because they do not even mention that a widget ID can be specified as `symbol or `id( any widgetId ). What are the actually supported types to specify a widget ID? Currently I know about symbol and term where the latter seems to require the special form `id( any widgetId ). Does an arbitrary term like `foo(bar,baz) also work? And what about other types like string, e.g. does UI::ChangeWidget("widget_id_string",... also work? According to http://forgeftp.novell.com/yast/doc/SL11.1/tdg/UI-Event-UserInput.html "a widget ID can be of any valid YCP type, but using simple types like symbol, string or maybe integer is strongly recommended" Why "maybe"? Does integer work or not? At least using strings as in UI::ChangeWidget("my_nice_widget",... must work and "maybe" also integers as in UI::ChangeWidget(123,... should work but it seems it is not used in current YCP code. Why not? UI::ChangeWidget("widget_id_string",... looks much more simple and straightforward than UI::ChangeWidget(`id(`widget_id_string),...
Therefore for example in UI::ChangeWidget(`id("widget_id_string"),... the literal constant `id("widget_id_string") seems to be more like a function call of a function named id with prototype/signature symbol id ( any ) but I cannot even find such a function documented.
I use and used `id() by "look at other code" all the time but now I have the strange idea to try to understand it ;-)
In particular I wonder why UI::whatever_widget_function(`id(`widget_id_symbol),... is used most often in YCP code instead of simply calling UI::whatever_widget_function(`widget_id_symbol,... which is also (less often) used in YCP code.
For me `id(`widget_id_symbol) looks like a useless "call" of a symbol->symbol conversion.
`id is a term, not a function call. If the ID is a symbol, you can say `foo or `id(`foo), where the latter is preferred for consistency.
More exactly, as far as I understand http://forgeftp.novell.com/yast/doc/SL11.1/tdg/id_ycp_data_term.html `id is not a term but a symbol and `id( list of any types ) is a term but `id(`foo) is a special term where its list is a single symbol so that `foo and `id(`foo) are of different type. Could you describe in more detail what "preferred for consistency" means when actually the UI widget functions support other types as well? I.e. what breaks when something else than `id(`foo) is used? In particular what breaks when `id("widget_id_string") is used? Kind Regards Johannes Meixner -- SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany AG Nuernberg, HRB 16746, GF: Markus Rex -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (3)
-
Johannes Meixner
-
Lukas Ocilka
-
Martin Vidner