Menu

#1196 Subclassing string to limit strings to numbers only does not work as expected

v4.2.0
closed
None
none
1
2014-04-15
2013-09-17
No

Open Object Rexx Version 4.1.2
Build date: Aug 28 2012
Addressing Mode: 64

Running attached code yields self=45 as not a number in the Test2 class.
Bypass is to add 0 to self before the number test as in Test1 class.

1 Attachments

Discussion

  • Rick McGuire

    Rick McGuire - 2013-09-17
     
  • Rick McGuire

    Rick McGuire - 2013-09-17

    Committed [r9427]

     

    Related

    Commit: [r9427]

  • Rick McGuire

    Rick McGuire - 2013-09-17
    • status: open --> pending
    • Group: None --> Next_Release
     
  • Rick McGuire

    Rick McGuire - 2013-11-22
    • Group: Next_Release --> v4.2.0
     
  • Ruurd Idenburg

    Ruurd Idenburg - 2013-11-22

    Just recently I noticed that the arithmetic operators don't seem to work as expected as well, with the error message "Non numeric value("45.154") used in arithmetic operation", where the value belongs to the argument of the operation (not the receiver). May I assume the fix will also cater for that problem?

     
  • Rick McGuire

    Rick McGuire - 2013-11-22

    Not sure I understand what you are doing. Please provide a sample program illustrating the error.

     
  • Ruurd Idenburg

    Ruurd Idenburg - 2013-11-22

    Ok, will do that tomorrow, it's "sleepy sleepy time now".

     
  • Rick McGuire

    Rick McGuire - 2013-11-22

    Committed new fix [r9543]. Somehow the original fix got lost.

     

    Related

    Commit: [r9543]

  • Ruurd Idenburg

    Ruurd Idenburg - 2013-11-23

    Sample program attached.

     
  • Rick McGuire

    Rick McGuire - 2013-11-23

    This appears to fix this problem too.

     
  • Ruurd Idenburg

    Ruurd Idenburg - 2013-11-23

    Great, thanks Rick.

     
  • Ruurd Idenburg

    Ruurd Idenburg - 2013-11-26

    Rick, I would expect the result of an arithmetic operator on 2 objects of a the same subclass of string to be an object of the subclass rather than an object of superclass (i.e. the string class) as is shown by the attached code sample. What do you think?

     
  • Rick McGuire

    Rick McGuire - 2013-11-26

    Not unless you override the method and implement it that way yourself. The
    docs specifically say it returns a string object. And this is NOT going to
    be implemented, as it has some major performance considerations.

    Rick

    On Tue, Nov 26, 2013 at 5:07 AM, Ruurd Idenburg idenburg@users.sf.netwrote:

    Rick, I would expect the result of an arithmetic operator on 2 objects of
    a the same subclass of string to be an object of the subclass rather than
    an object of superclass (i.e. the string class) as is shown by the attached
    code sample. What do you think?

    Attachment: num2.rex (236 Bytes; application/octet-stream)


    [bugs:#1196] Subclassing string to limit strings to numbers only does
    not work as expected

    Status: pending
    Created: Tue Sep 17, 2013 09:51 PM UTC by Ruurd Idenburg
    Last Updated: Sat Nov 23, 2013 11:57 AM UTC
    Owner: Rick McGuire

    Open Object Rexx Version 4.1.2
    Build date: Aug 28 2012
    Addressing Mode: 64

    Running attached code yields self=45 as not a number in the Test2 class.
    Bypass is to add 0 to self before the number test as in Test1 class.


    Sent from sourceforge.net because you indicated interest in <
    https://sourceforge.net/p/oorexx/bugs/1196/>

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

     
  • Ruurd Idenburg

    Ruurd Idenburg - 2013-11-27

    I guess I figured that more or less, it's a pity but understandable, with strings being the building blocks.

     
  • Ruurd Idenburg

    Ruurd Idenburg - 2013-11-28

    Rick a while back you're were asking (I believe) what I wanted to do. The attached code is a sample of what I intended. With one of the the latest builds from build.oorexx.org this works as I want it to work, with subclassed arithmetic operators as discussed.

     
  • Rick McGuire

    Rick McGuire - 2014-04-15
    • status: pending --> closed
     

Anonymous
Anonymous

Add attachments
Cancel