Menu

gtm_boolean, gtm_side_effects and $select() in logical expressions

Developers
2016-06-02
2016-06-22
  • Konstantin Aristov

    Hi!

    The gtm_boolean and gtm_side_effects is 0.
    This simple example shows the relationship:

        s str="....",X=0,c=""
        i $s(c="":0,1:str?@c)!$s(c="":0,1:$i(X))
    

    In this case, all is well: variable X is not changed and the code str?@c is not executed.

    Сhange the expression sites:

        s str="....",X=0,c=""
        i $s(c="":0,1:$i(X))!$s(c="":0,1:str?@c)
    

    Variable X still does not change, but we get the error:
    %GTM-E-PATCODE, Illegal syntax for pattern.

    By gtm_boolean and gtm_side_effects We can change this behavior, but we get the problem elsewhere.

    s X=0 i X&$i(X)
    

    this changes the value of X

                      Best regards, Konstantin
    

    PS $ZV = GT.M V6.3-000 Linux x86_64

     

    Last edit: Konstantin Aristov 2016-06-02
    • Maury Pepper

      Maury Pepper - 2016-06-11

      Konstantin,

      You have pointed out two non-standard features of GT.M which can be made to behave in a standard way by changing environmental variables. My concern is that your second example:
      s X=0 i X&$i(X)
      Standard behavior is to change the value of X. If you want to use non-standard features of GT.M, that is your privilege, but if you want standard behavior, then why complain about the value of X changing. It seems inconsistant to me, but perhaps I do not understand your expectations.

       
      • Konstantin Aristov

        Dear Maury !
        I thought that is the standard behavior GT.M in this example. does not compute the $ i (x). And so it is! If you want to reverse, it is necessary to set the environment variable gtm_boolean = 1. My example was about the strange behavior of the function $select ().
        Thank you for your interest in my question. Konstantin.

         
        • Maury Pepper

          Maury Pepper - 2016-06-22

          By "standard", I do not mean "normal for GT.M". The MUMPS standard is for strict, left-to-right evaluation. Normal behavior for GT.M is to short-circuit some boolean operations and to reorder some arguments. These features may improve the execution speed of GT.M, but they are non-standard.

           
  • FIS GT.M Support

    Thank you for reporting this issue with GT.M. We have assigned it identifier GTM-8572 and will address it in a future GT.M release.

    There is unfortunately no workaround other than coding around it, if you can't change gtm_boolean and gtm_side_effects.

    Thanks,
    Bill

     
    • Konstantin Aristov

      Hi, Bill !

      Thanks for the answer. We look forward to the new release.

      Thanks,
      Konstantin.

       

Log in to post a comment.