Skip to content

Add variables to evaluation namespace of Evaluate, Run Keyword If, ... #2040

Closed

Description

@jussimalinen

Robot's variables should be added to Evaluate keyword's namespace automatically. This also simplifies greatly evaluation of conditions in keywords like Run Keyword If, because they use internally the Evaluate keyword.

*** Keywords ***
Example
    ${something} =    Set variable   value
    Run keyword if     len(something) == 5     This is executed
    Evaluate     something.upper()

Activity

  1. self-assigned this
    on Jun 22, 2015
  2. added this to the 2.9 milestone on Jun 22, 2015
  3. changed the title [-]`BuiltIn.Evaluate` add variables to namespace automatically[/-] [+]Add variables to evaluation namespace of `Evaluate`, `Run Keyword If`, etc automatically[/+] on Jun 22, 2015
  4. changed the title [-]Add variables to evaluation namespace of `Evaluate`, `Run Keyword If`, etc automatically[/-] [+]Add variables to evaluation namespace of `Evaluate`, `Run Keyword If`, etc[/+] on Jun 22, 2015
  5. changed the title [-]Add variables to evaluation namespace of `Evaluate`, `Run Keyword If`, etc[/-] [+]Add variables to evaluation namespace of `Evaluate`, `Run Keyword If`, ...[/+] on Jun 22, 2015
  6. pekkaklarck commented on Jun 29, 2015

    @pekkaklarck
    Member

    We decided to change the syntax so that automatic variables need a $ prefix like in $example. This both makes it easier to see where variables are used and avoids problems with variables that match Python built-in names.

    With the new implementation, for example, $list refers to Robot's variable ${list} and list to Python built-in. It is possible to even have something like list($list).

    This change is obviously backwards incompatible with the functionality in RF 2.9 beta 1. This shouldn't be a surprise, though, because release notes already mentioned that the syntax can change.

  7. pekkaklarck commented on Jun 30, 2015

    @pekkaklarck
    Member

    Documentation of using $variable syntax in expressions has now been updated. This issue ought to be ready to be closed again, but a review (especially new docs) by @jussimalinen would still be great. Comments from others are obviously highly appreciated too.

  8. jussimalinen commented on Jul 1, 2015

    @jussimalinen
    MemberAuthor

    The evaluating expressions chapter does a good job of explaining the concept. Looks good to me. Closing as done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions