[kepler-dev] [Ptolemy] Change in array types

Christopher Brooks cxh at eecs.berkeley.edu
Wed Sep 6 14:45:56 PDT 2006


I was hoping to get a release out sometime over the next few days.
The tree is in fairly good shape.  This change seems likely to
really break things - not just Copernicus.

As Steve says, Copernicus works well enough to ship so that
someone can take it further.   I don't want to hold up
development because of Copernicus, but I also don't want
to toss Steve's work if this change breaks Copernicus.

In principle, we are in somewhat of a freeze until I
ship an alpha.

So, this is a bit of a quandary.

If you make the change, and things break, then we
will not see a release until late September.

If you do not make the change, then perhaps I
can get something out by next Wednesday, 9/13.

I propose that you hold off in making the change
until after Wednesday, 9/13.

_Christopher`





> > I guess a key question is whether to wait until after the 
> > release to check this in... I doubt we can get copernicus 
> > fully functional again without it...
> > 
> > Edward
> 
> FYI: I think that copernicus is in pretty good shape, currently.
> There are quite a few tests failing, but I think these are mostly minor
> fixups and not major difficulties (although that doesn't make them any
> easier to fix).  I'm of the opinion that it works well enough at this
> point
> to release it in the hopes that someone will find it useful.
> 
> In particular to address the array type issue, I've added fix-point
> style type inference of type values that seems to work pretty well:
> I think many of the remaining test failures are simply a matter of
> propagating this change to the appropriate places.  In particular, I
> know that there's a problem with ports that have array type.

Edward writes:

--------

    
    I have a fix for the problem Steve identified where ArrayType.convert()
    was not in fact delivering an array of the type of the ArrayType on which
    it is called.  Unfortunately, all our actors that use arrays were
    exploiting this bug as follows:
    
    To declare that an input port has an array type, the actor would say:
    
             input.setTypeEquals(new ArrayType(BaseType.UNKNOWN));
    
    Of course, this should force the type to be exactly {unknown}, but
    the bug was allowing the type to deviate from that.
    
    The fix touches are large number of files and is not backward compatible.
    Every actor that explicitly operates on arrays had to be changed.
    I suspect that there are many Kepler actors that use arrays, and they
    will all need to be updated.  I'm happy to do that, but I'm wondering
    whether there are actors not in the repository.
    
    Part of the fix actually significantly improves things for writing
    actors that operate on arrays.  For example, ArrayToSequence wants
    to declare that the input is an array and that the output has
    type compatible with the array elements.  Currently, the code
    to do that is pretty obtuse:
    
             input.setTypeEquals(new ArrayType(BaseType.UNKNOWN));
             ArrayType inputArrayType = (ArrayType) input.getType();
             InequalityTerm elementTerm = inputArrayType.getElementTypeTerm();
             output.setTypeAtLeast(elementTerm);
    
    With my changes, it becomes:
    
             output.setTypeAtLeast(ArrayType.elementType(input));
    
    This forces the input port to have an array type and the
    output port to have a type at least that of the elements
    of input arrays.
    
    Correspondingly, SequenceToArray currently has obtuse type
    constraint declarations.  These become:
    
             output.setTypeAtLeast(ArrayType.arrayOf(input));
    
    If you just want to set a constraint that something (e.g.,
    a param) be an array, do:
    
             param.setTypeAtLeast(ArrayType.ARRAY_BOTTOM);
    
    As usual with type constraints, the same declarations need to
    be made in the clone methods.
    
    I guess a key question is whether to wait until after the
    release to check this in... I doubt we can get copernicus
    fully functional again without it...
    
    Edward
    
    
    ------------
    Edward A. Lee
    Professor, Chair of EECS
    231 Cory Hall, UC Berkeley, Berkeley, CA 94720-1770
    phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845
    eal at eecs.Berkeley.EDU, http://ptolemy.eecs.berkeley.edu/~eal  
    
    _______________________________________________
    Ptolemy maillist  -  Ptolemy at chess.eecs.berkeley.edu
    http://chess.eecs.berkeley.edu/ptolemy/listinfo/ptolemy
--------


More information about the Kepler-dev mailing list