qorf / quorum-language

The primary repository for the Quorum Programming Language
BSD 3-Clause "New" or "Revised" License
16 stars 7 forks source link

Accessing a variable from a class is allowed to be a standalone line #38

Closed GabeContra closed 1 year ago

GabeContra commented 1 year ago

Example Code:

class Main
    action Main
        Other other
        other:name
    end
end
class Other
    public text name = "name"
end

The line other:name doesn't feel like it should be a legal line. This code compiles fine and does nothing but maybe it's an error? The reason seems to be that other:name is parsed as an action call but it's not really an action but maybe that's okay?

andreas-stefik commented 1 year ago
class Main
     action Main
        Other other
        text value = other:name
        output value + other:name
        output value other:name //likely an accidental bug in user code
    end
end

One reason why this might be good to change is it hits on two things:

  1. It seems to be a real inconsistency in the language. Changing it fixes that.
  2. It fixes cases like the above, which are clearly accidental, as it is pretty unlikely that a user is intending to throw the second value away.
andreas-stefik commented 1 year ago

This is now fixed and should come out with the next release. While I checked pretty carefully and it passes the test suite, this exposed a number of issues in the parser that did not appear to be correct. As such, a bit of dog fooding is probably in order for this particular change, even if it seems like it is working on my end.

andreas-stefik commented 1 year ago

Fix is in commit 442f1801d