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

struct's #:methods missing in Typed Racket #1361

Open
xiaoyu2006 opened this issue Feb 5, 2024 · 3 comments
Open

struct's #:methods missing in Typed Racket #1361

xiaoyu2006 opened this issue Feb 5, 2024 · 3 comments

Comments

@xiaoyu2006
Copy link

xiaoyu2006 commented Feb 5, 2024

What version of Racket are you using?

8.10

What program did you run?

In normal racket:

#lang racket/base

(require racket/generic)

(define-generics testable
  (test testable))
  
(struct myst (sth)
  #:methods gen:testable
  [(define (test self) (myst-sth self))])

(define x (myst "3648"))
(test x)  ;; => "3648"

However, in Typed Racket:

#lang typed/racket/base

(require racket/generic)

(define-generics testable
  (test testable))
  
(struct myst ([sth : Any])
  #:methods gen:testable
  [(define (test self) (myst-sth self))])

(define x (myst "3648"))
(test x)  ;; => ERROR: struct: expected one of these literals: #:mutable, #:transparent, #:prefab, #:constructor-name, #:extra-constructor-name, #:type-name, #:guard, or #:property

If you got an error message, please include it here.

HelloWorld.rkt:8:0: struct: expected one of these literals: #:mutable, #:transparent, #:prefab, #:constructor-name, #:extra-constructor-name, #:type-name, #:guard, or #:property
  at: #:methods
  in: (struct myst ((sth : Any)) #:methods gen:testable ((define (test self) (myst-sth self))))
  parsing context: 
   while parsing typed structure type options
    term: (#:methods gen:testable ((define (test self) (m...
    location: <pkgs>/yacp/HelloWorld.rkt:8:0
  location...:
   HelloWorld.rkt:9:2
  context...:
   /Applications/Racket v8.10/collects/syntax/parse/private/runtime-report.rkt:739:0: error/report
   /Applications/Racket v8.10/collects/syntax/parse/private/runtime-report.rkt:25:0: call-current-failure-handler
   /Applications/Racket v8.10/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:71:0: tc-setup
   /Applications/Racket v8.10/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:22:4
@sorawee
Copy link
Contributor

sorawee commented Feb 5, 2024

If I understand correctly, that's simply because it's not supported. The error message could be changed to indicate that it's not supported though.

@xiaoyu2006
Copy link
Author

If I understand correctly, that's simply because it's not supported. The error message could be changed to indicate that it's not supported though.

If this is the case, when will this feature supported? 👀

@samth
Copy link
Sponsor Member

samth commented Feb 6, 2024

We do not have any timeline for that.

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