Mailinglist Archive: yast-devel (101 mails)

< Previous Next >
Re: [yast-devel] Where is '`id()' documented?
  • From: Johannes Meixner <jsmeix@xxxxxxx>
  • Date: Fri, 22 Jan 2010 10:48:59 +0100 (CET)
  • Message-id: <alpine.LNX.2.00.1001221017470.14367@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >