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

racket/class methods are always annotated as "no bound occurrences" #369

Open
greghendershott opened this issue Apr 9, 2020 · 3 comments

Comments

@greghendershott
Copy link
Contributor

As discussed here: greghendershott/racket-mode#440

As with #366 I'm not sure if this can/should be fixed in drracket/check-syntax as opposed to the source e.g. racket/class.

@sorawee
Copy link
Contributor

sorawee commented Jun 11, 2020

Do we want an arrow for f in the following scenario (from define to private)?

(class object%
  (super-new)
  (private f)
  (define (f) 1))

If the answer is yes, then perhaps a solution is to add a new kind of syntax property, like disable-no-bound-occurrence. The class form should attach this syntax property, and then Check Syntax would need to be modified to skip reporting no bound occurrences when this syntax property is found.

If the answer is no, then I think we can simply change the class form to remove disappeared-binding.

@sorawee
Copy link
Contributor

sorawee commented Jun 11, 2020

Hmm.

#lang racket

(define-syntax-rule (p x)
  (begin
    (provide x)
    (define x 1)))

(p a)

reports that a in (p a) has no bound occurrences. This p is similar to define/private because define/private similarly expands to (begin (private x) (define (x ...) ...)).

So I think there are two bugs here.

  1. Currently there is no arrow from the identifier in define to the identifier in private (in the above comment). This should be fixed so that it's similar to how there's an arrow from define to provide.
  2. For macros like define/private and p, there should be a general mechanism to detect that the identifier is "used" already in the expanded form so that it skips reporting "no bound occurrences". That means my ad-hoc solution (disable-no-bound-occurrence) doesn't look like a good idea anymore.

@rfindler
Copy link
Member

For point 2 above, I think it might be fixable inside check syntax. If so, the fix would be some where in this general vicinity. It may be that the argument (connections) needs some more information it, tho, I suppose.

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

3 participants