Mailinglist Archive: yast-devel (101 mails)

< Previous Next >
Re: [yast-devel] Where is '`id()' documented?
  • From: Martin Vidner <mvidner@xxxxxxx>
  • Date: Fri, 22 Jan 2010 09:48:34 +0100
  • Message-id: <20100122084832.GB6321@xxxxxxxxxxxxxxxx>
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
< Previous Next >
References