beefytech / Beef

Beef Programming Language
http://www.beeflang.org
Other
2.51k stars 131 forks source link

[Bug] Debugger: Hover on variable shows misleading value #2016

Closed Hiroko103 closed 2 months ago

Hiroko103 commented 2 months ago

If a method in a class contains a variable with the same name as one of the class' variable, then hovering on the class' variable during debugging will show the value of the variable inside the method.

beef-debugger-variable

Code:

namespace beefbug;

class A {
    public int var1 = 5;

    public void Method(){
        let var1 = 10;
    }
}

class Program
{
    public static void Main(){
        A a = scope A();
        a.Method();
    }
}

Version: 0.43.5 (Nightly 08/23/2024)

bfiete commented 2 months ago

Yeah, that's life. There isn't a debugger in the world that handles that case.

bfiete commented 2 months ago

The mental model you need is this: mousing over text just evaluates the text you mouse over. That's it. There is no "surrounding context" taken into account. That's how all debuggers work that I have ever seen.

Hiroko103 commented 2 months ago

Ohh.. I didn't know it. Although I was half-expecting this answer. It seems Beef was the first language in which I got into a situation like this. I tried it with two other languages and you're right, they also work the same way.