6 <:compargs:>

<:compargs [argname] [argname1=expr] 
     [argname2=expr...] [**kwargname]:>

This tag allows you to create a component signature, i.e. specify which arguments the component expects and provide some default values for them. When someone calls your component, SkunkWeb will make sure that the arguments it is called with match the signature. The arguments specified by the <:compargs:> tag will appear in the local namespace. The tag is optional, if you do not specify it, all of the arguments passed to the component will appear in the local namespace. You can optionally specify default values for the arguments. If an argument is not passed by the caller and it has a default value, the default value will be used for the local variable

If your component accepts variable number of arguments, you can use the **kwargs notation to specify a container for any additional arguments. Any arguments not explicitely listed in the <:compargs:> tag will be stored in the kwargs variable. If you do not specify such a variable, and the component is called with arguments not listed in the <:compargs:> tag, an exception will be raised.

Suppose your component has the following signature:

<:compargs x y=`10` z='hello' **kwargs :>

Suppose someone calls the component with following call:

<:component comp x='hi' y=`11` extra=`12`:>

In this case the following variables will appear in local namespace:

x
The value is string 'hi'
y
The value is integer 11
z
The value is string 'hello', taken from default
kwargs
The value is a dictionary: { 'extra' : 12 }