Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of the need for the .worthy-attributes hack #50

Closed
masak opened this issue Oct 18, 2015 · 0 comments
Closed

Get rid of the need for the .worthy-attributes hack #50

masak opened this issue Oct 18, 2015 · 0 comments

Comments

@masak
Copy link
Owner

masak commented Oct 18, 2015

This is an internal thing, but kind of a technical debt issue.

method worthy-attributes {
    sub aname($attr) { $attr.name.substr(2) }
    sub avalue($attr) { $attr.get_value(self) }
    sub worthy($attr) {
        avalue($attr) !~~ Hash  # avoids showing static-lexpad
            && (aname($attr) ne "type" || avalue($attr) ne "")
    }

    return self.^attributes.grep(&worthy);
}

We filter away two things:

  • static-lexpad a thing in Q::Statements blocks which we're not even sure belongs there or anywhere, really
  • Empty string type (because in the cases when they're empty, they don't add anything)

.worthy-attributes used to be just an inner convenience sub, at which point it was OK and nobody's business. But as part of 690f60a, it got promoted to a method, and this makes it ugly. To me it suggests that both static-lexpad and type should die a gruesome death so the method can be removed.

Removing static-lexpad is the big mystery. It's all tangled up in exactly how much "context" a Qtree really has (or should have). Related tickets are #20 and #47.

Removing type should be dead easy. I think it was there to make some nicer stringification, basically. But after #45 I bet it isn't even used. I could be wrong, though — maybe it's used in custom operator lookup? If it is, then the correct way forward is to allow it on all of them, again making this exception go away.

@masak masak closed this as completed in 26b8db8 Nov 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant