Hi Adriana,
The problem here is that setting values to the no value usually
means that the default value is to be used when the model is
read back in.

There are several types of similar values:
- The empty string, usually denoted by ""
- Nil tokens, aka missing, null or empty tokens.  These tokens mean
that there is no data.
- "no value" tokens - if I remove the value of a parameter and commit.

Here, we are focussing on the "no value" case.

It might be easier to talk about the Const actor first.

If I create a model that has a Const actor and set the value to the
no value, that is, I remove the 1 and leave the input blank, then
when I view the moml, I see

    <entity name="Const" class="ptolemy.actor.lib.Const">
        <property name="value" class="ptolemy.data.expr.Parameter">
        <property>
       ...
    </entity>

If this model is saved, then that is what is written to disk.
When the model is read in, the default value of the value parameter is
used, which is 1.  Usually, this is what we want.  The user
did not specify a value, so we use the default value. 

In this case, with Const, we can set the value to the empty string by
using two double quotes: "".  Then, when the Const actor fires, we get
empty strings.

The InteractiveShell actor has a prompt PortParameter that of type
String, but is in string mode.  The bug here is that there is no way
to make the prompt PortParameter be the empty string because
the parameter is in string mode.

This is a limitation of string mode.

The workaround is to create a Parameter that has as its value the
empty string, and then refer to the Parameter using the string mode
$ notation.  For example, if I create a Parameter named
myEmptyString and set the value to "", then I can set the value
of the prompt parameter to $myEmptyString and then the value
of the prompt will be the empty string.

I updated the docs for InteractiveShell and Variable to mention
this workaround.

_Christopher


--------

    Hi all,
    I discovered a possible bug. Infact, I noticed that if an actor has a 
    parameter, or portParameter, with a default value, if the default value 
    is removed and no value is used, the save function doesn't work; when 
    the model is re-opened the parameter recovers its default value.
    An example is the InteractiveShell actor in which the default value of 
    promt portParameter is ">>".
    
    Thanks,
    Adriana
    
    
    ---------------------------------------------------------------------------
   -
    Posted to the ptolemy-hackers mailing list.  Please send administrative
    mail for this list to: [EMAIL PROTECTED]
--------

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to