How to use a uint in the scripting

Hi,

i would like to use a uint variable in the
orocos-scripting/taskbrowser.

But i cannot assign a value to it:

var uint a = 1

results in
0.914 ERRORLogger cpf/states.osd :Parse error at line 7:
Semantic error: Attempt to initialize a var uint with a int.

is this a bug or do i have to assign it another way?

Ruben

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

How to use a uint in the scripting

On Friday 08 February 2008 16:22:44 Ruben Smits wrote:
> Hi,
>
> i would like to use a uint variable in the
> orocos-scripting/taskbrowser.
>
> But i cannot assign a value to it:
>
> var uint a = 1
>
> results in
> 0.914 ERRORLogger cpf/states.osd :Parse error at line 7:
> Semantic error: Attempt to initialize a var uint with a int.
>
> is this a bug or do i have to assign it another way?

uint is hardly supported, the type is known, but no operations can be done
yet. I advise to use 'int' in your scripting interfaces. The only solution to
this is writing a constructor for uint which takes an int as argument, such
that you can write

 var uint a = uint( -3 );

But we could also define auto-conversion rules in the scripting syntax, which
is a feature requiring more implementation work than adding the constructor.

Talking about features, another thing I miss often is the ability to define
variables in the taskbrowser prompt:

 var int a = 3
 now use 'a' in taskbrowser prompt

The variable 'a' would then be added to the interface of the current
component. Technically it is even possible to drop the 'var' prefix in the
taskbrowser.

Peter