Re: [Jastadd] Feature request: fullCopy() improvements

From: Jesper qvist <jesper.oqvist_at_cs.lth.se>
Date: Wed, 15 Feb 2012 09:28:04 +0100

Hi Jesper,
Regarding the first part of your request we already have an open ticket:
http://svn.cs.lth.se/trac/jastadd-trac/ticket/12 - It's been a known
problem for some time.

/Jesper

On 02/14/2012 03:26 PM, Jesper Mattsson wrote:
>
> Hi
>
> I have two feature requests concerning fullCopy():
>
> When a node is copied with fullCopy(), then the parent field is also
> copied. This means that some inherited attributes work on the copy
> even before it is placed in a new position in the tree (and some can
> give wrong values). However, this might not always be desired, and can
> also mask bugs. I suggest that the parent field is set to nullin the copy.
>
> All non-abstract node types override fullCopy(), and thus the
> following will compile clean:
>
> A newA = getA().fullCopy();
>
> However, for abstract node types it will need a cast, since the return
> value of fullCopy() will be the nearest non-abstract superclass.
>
> I suggest that the following declaration is added to all abstract node
> types:
>
> public abstract A fullCopy();
>
> Where A is the name of the node type. This would mean that the return
> type of B.fullCopy() would be B for all node types B.
>
> Jesper
>
> *Jesper MATTSSON, MSc*
>
> Software Developer & IT Administrator
>
> Phone direct: +46 73 324 5909
>
> Email: jesper.mattsson_at_modelon.com <mailto:jesper.mattsson_at_modelon.com>
>
>
> Description: Description: Description: Modelon_2011_Gradient_RGB_400
>
> ------------------------------------------------------------------------
>
> Modelon AB
> Ideon Science Park
> SE-223 70 Lund, Sweden
>
>
>
> Phone: +46 46 286 2200
> Fax: +46 46 286 2201
>
>
>
>
> Web: http://www.modelon.com <http://www.modelon.com/>
>
>
> _______________________________________________
> JastAdd mailing list
> JastAdd_at_cs.lth.se
> https://mail1.cs.lth.se/cgi-bin/mailman/listinfo/jastadd
Received on Wed Feb 15 2012 - 09:27:21 CET

This archive was generated by hypermail 2.3.0 : Wed Apr 16 2014 - 17:19:06 CEST