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

ftype-set! example in CSUG seems to have regressed #707

Closed
jeffhhk opened this issue Jul 19, 2023 · 3 comments
Closed

ftype-set! example in CSUG seems to have regressed #707

jeffhhk opened this issue Jul 19, 2023 · 3 comments

Comments

@jeffhhk
Copy link

jeffhhk commented Jul 19, 2023

I am consolidating fragments across a few pages, so I could be misreading what was intended. Code is identical in CSUG 9.4 and 9.5.

Tested on 9.5 official binaries, and 9.5.8 build from source:

;; 4.5. Foreign Data
(import (chezscheme))
(define-ftype B
  (struct
   [b1 integer-32]
   [b2 (array 10 integer-32)]))
(define b
  (make-ftype-pointer B
	          (foreign-alloc
	           (* (ftype-sizeof B) 3))))
(ftype-set! (b1) b 5)
;; => Exception: invalid syntax (ftype-set! (b1) b 5)
@burgerrg
Copy link
Contributor

The last line should be:
(ftype-set! B (b1) b 5)

See https://cisco.github.io/ChezScheme/csug9.5/foreign.html#./foreign:s152 for a description of ftype-set!.

@jeffhhk
Copy link
Author

jeffhhk commented Jul 19, 2023

Ah, indeed. My bad.

@jeffhhk jeffhhk closed this as completed Jul 19, 2023
@jeffhhk
Copy link
Author

jeffhhk commented Jul 19, 2023

Thanks!

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

2 participants