Boo
  1. Boo
  2. BOO-251

Local variables not falling out of scope properly.

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.7
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      Latest Boo SVN. ;)
    • Number of attachments :
      0

      Description

      if true:
      kipper = 1
      elif false:
      kipper = "FUTZ!"

      Self-explainatory.

      But, just to be redundant: kipper should have fallen out of scope once the "if" block ended, and so should be available as a variable name in the elif block.

        Activity

        Hide
        Arron Washington added a comment -

        Whoops, I wasn't very clear.

        This is the message the compiler is generating:

        BCE0022: Boo.Lang.Compiler.CompilerError: Cannot convert 'System.String' to 'System.Int32'

        Show
        Arron Washington added a comment - Whoops, I wasn't very clear. This is the message the compiler is generating: BCE0022: Boo.Lang.Compiler.CompilerError: Cannot convert 'System.String' to 'System.Int32'
        Hide
        Rodrigo B. de Oliveira added a comment -

        That's the expected behavior.

        Only methods and closures define a new scope. A behavior more inline with our python heritage.

        Show
        Rodrigo B. de Oliveira added a comment - That's the expected behavior. Only methods and closures define a new scope. A behavior more inline with our python heritage.
        Hide
        Arron Washington added a comment -

        Wow, OK. That feels slightly counter-intuitive (makes it kind of hard to reuse variable names).

        However, you are the language designer, so I'll assume your judgement's better than mine.

        Show
        Arron Washington added a comment - Wow, OK. That feels slightly counter-intuitive (makes it kind of hard to reuse variable names). However, you are the language designer, so I'll assume your judgement's better than mine.
        Hide
        Rodrigo B. de Oliveira added a comment -

        This is how is meant to be.

        Show
        Rodrigo B. de Oliveira added a comment - This is how is meant to be.

          People

          • Assignee:
            Rodrigo B. de Oliveira
            Reporter:
            Arron Washington
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: