Menu

#79 Incorrect Code Generated

None
closed
generation (5)
1
2013-06-21
2013-06-01
No

Discussion

  • Alex Proudfoot

    Alex Proudfoot - 2013-06-01

    The return types of the Get_Next functions on classes Attribute Question and Name Question are generated as Attribute Question and Name Question, i.e. there are spaces instead of underscores and .Handle is not appended.

     

    Last edit: Alex Proudfoot 2013-06-01
  • Simon Wright

    Simon Wright - 2013-06-01

    Ticket moved from /p/coldframe/support-requests/6/

     
  • Simon Wright

    Simon Wright - 2013-06-01
    • labels: --> generation
    • Group: (not used) -->
     
  • Alex Proudfoot

    Alex Proudfoot - 2013-06-01

    If I attempt to work round by removing the spaces from the class names (creating AttributeQuestion and NameQuestion) the generated code does not compile (see screenshot) ...

     
    • Simon Wright

      Simon Wright - 2013-06-02

      You could equally have put the underscores in.

      The trouble is that CF doesn't use programming language inheritance to implement super/subtypes. Both the parent and the child are independently derived from ColdFrame.Instances.Instance_Base.

      In any case, Get_Next() would need to return the same type in both parent and child, which I would expect to be Question (if not, aside from the profile mismatch, what is going to happen if the last Attribute_Question wants to answer with a Name_Question?).

      Even if you do that, there is a translation-related problem: in Question, ':Question' is translated to 'return Handle' i.e. 'access all Instance', whereas in Attribute_Question it's translated as 'ColdFrame.Instances.Handle', i.e. 'access all Instance_Base'Class'.

      You might think that a function-returning-this-class should be translated to 'return ColdFrame.Instances.Handle', like a function-returning-another-class. But, for now, the way round is to declare a type say CIH which is a renaming of ColdFrame.Instances.Handle and have both Question.Get_Next and Attribute_Question.Get_Next return CIH.

       
  • Simon Wright

    Simon Wright - 2013-06-02
    • status: open --> pending
    • assigned_to: Simon Wright
     
  • Simon Wright

    Simon Wright - 2013-06-02

    Fixed in rev 96a801ba7910, which will be uploaded asap.

     
  • Alex Proudfoot

    Alex Proudfoot - 2013-06-02

    Hmmm. That rings a bell. :)
    Did a function-returning-this-class not return ColdFrame.Instances.Handle in the Rational Rose days? Anyway, I'll download the update when available, try your work round and let you know how it goes. Thanks.

     
  • Simon Wright

    Simon Wright - 2013-06-02

    Looking at the generator XSL, function-returning-this-class has returned Handle since at least 2005 (date of a comment) and probably 2003.

    On 2 Jun 2013, at 15:30, Alex Proudfoot alexproudfoot@users.sf.net wrote:

    Hmmm. That rings a bell. :)
    Did a function-returning-this-class not return ColdFrame.Instances.Handle in the Rational Rose days? Anyway, I'll download the update when available, try your work round and let you know how it goes. Thanks.


    ** [bugs:#79] Incorrect Code Generated**

    Status: pending
    Labels: generation
    Created: Sat Jun 01, 2013 07:04 AM UTC by Alex Proudfoot
    Last Updated: Sun Jun 02, 2013 12:16 PM UTC
    Owner: Simon Wright


    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/coldframe/bugs/79/

    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     
  • Simon Wright

    Simon Wright - 2013-06-21
    • status: pending --> closed
     

Log in to post a comment.