Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Expression Evaluation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Expression Evaluation

    Say in a script you have something like:

    Code:
    select
    case A=1 .and. B=2
    do this
    
    case (A=2.and.B=3).or.C=1
    do this
    end select
    At what point does the expression fails and alpha move on to the next selection?

    In the first case:
    Does it fail immediately at A if A <>1? or does evaluate the whole expression?

    In the second case: same quesion.

    #2
    Re: Expression Evaluation

    To see how code evaluates and when use code like the following;
    Code:
    a=3
    b=6
    c=2
    
    select
    case A=afunc(1,"msg A1") .and. B=afunc(2,"msg B1")
        ui_msg_box("","1")
    case (A=afunc(2,"msg A2").and.B=afunc(3,"msg B2")).or.C=afunc(1,"msg C2")
        ui_msg_box("","2")
    end select
    
    end
    '============================
    function afunc as a(val as A,msg="" as c)
    ui_msg_box("",msg)
    afunc=val
    end function
    Regards,

    Ira J. Perlow
    Computer Systems Design


    CSDA A5 Products
    New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
    CSDA Barcode Functions

    CSDA Code Utility
    CSDA Screen Capture


    Comment


      #3
      Re: Expression Evaluation

      Ira:
      I have a sense of dissmay!

      Running your sample test shows few things that I didn't expect nor hoped to see:

      a-Alpha is evaluating the expression from right to left. That's not a big deal.

      b-I hope I am wrong on this, but from the looks of it, alpha is not following the precedence rules. That is the bad part.

      c-Before failing the expression, alpha evaluates the entire expression. That would be the worst part.

      Comment


        #4
        Re: Expression Evaluation

        Originally posted by G Gabriel View Post
        a-Alpha is evaluating the expression from right to left.
        Very typical of most languages

        Originally posted by G Gabriel View Post
        b-I hope I am wrong on this, but from the looks of it, alpha is not following the precedence rules.
        It is following the precedence rules. Each level of precedence is evaluated before moving to the next level. Within a precedence level, it can be any order. You can prove it by placing parenthesis around sections and see that the insides of parenthesis are evaluated prior to being needed elsewhere in the expression.

        Originally posted by G Gabriel View Post
        c-Before failing the expression, alpha evaluates the entire expression. That would be the worst part.
        See Lazy Evaluation and related links.

        If using an IF(logical_expr, true_expr, false_expr), you will find the false expression is not evaluated if true. This allows for expressions to test for divide by 0 by not executing the 2nd part within the function. But this has nothing to do with expression evaluation, as it is within the function's code as to the order of evaluation of it's parameters (although the false expression is treated special, because normally, that value would be calculated at the call of the function since most expressions are call by value. In this case, it is more like the middle parameter of *for_each(), where you are not really evaluating the parameter, but passing it as a string (even though there are no quotes around it.
        Regards,

        Ira J. Perlow
        Computer Systems Design


        CSDA A5 Products
        New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
        CSDA Barcode Functions

        CSDA Code Utility
        CSDA Screen Capture


        Comment


          #5
          Re: Expression Evaluation

          I am not really sure if it is following the rules. It is evaluating .or. before .and. even after enclosing .and. in parenthisis.
          See attached image showing first msg:


          While I agree with you that evaluating right to left is most common in most programming languange, alpha no exception, yet I thought in case of select it might work left to right as it's counterpart case(). Again, it's not a big issue.

          I had hoped that once alpha comes across a false statment that it will abandon the rest of the expression and move on to the next one. For example, in an expression like:

          case A=1.and. B=2

          since alpha will evalute this right to left and if b does not equal 2, and since the expression states .and. then regardless of what A is the expression will render a false value. I had hoped that once alpha comes across the first false statment that it will abandon the rest of the expression and move on to the next line. But here, alpha will continue to evalue the rest of the expression, that is it will test to see if A equals 1, which is a useless test.
          Last edited by G Gabriel; 04-04-2008, 08:48 AM.

          Comment


            #6
            Re: Expression Evaluation

            Taking a second look at this, maybe not:
            The .or. statment is part of th last statment and thus it was evaluated first.
            Parenthises always a help.

            I have no bone to pick with any of that except, I wish alpha did not evaluate the whole expression. The expression in this example is very simple, but if it were a more complex one and if it is to be evaluated over so many iterations, then it becomes a problem.

            Comment

            Working...
            X