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

The behaviour of prop:object-name does not play well with #:auto fields. #4940

Open
dented42 opened this issue Feb 26, 2024 · 0 comments
Open

Comments

@dented42
Copy link
Contributor

What version of Racket are you using?
Racket 8.12 [cs]

What program did you run?

#lang racket/base

(struct thing-1 (a [b #:auto])
  #:auto-value 'b
  #:property prop:object-name (struct-field-index a))
(struct thing-2 (a [b #:auto])
  #:auto-value 'b
  #:property prop:object-name (struct-field-index b))

(object-name (thing-1 'a)) ; => 'a
(object-name (thing-2 'a)) ; => 'b (except it isn't)

What should have happened?
One would except to get back the values 'a and 'b.

If you got an error message, please include it here.
We get 'a as expected but instead of 'b we get the error:

guard-for-prop:object-name: field index >= initialized-field count for structure type
  field index: 1
  initialized-field count: 1

Please include any other relevant details
Looking at the racket source, It's not clear why this error happens but it does seem to be intentional. If that is the case then the correct course of action would probably be to alter the documentation of object-name to specify what kinds of fields can and cannot be used as names.

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