Re: [racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Eric Dobson
I've actually simplified my program that causes the issues and it doesn't need the callback or the foreign functions at all it just needs structs with substructs. This shows that if garbage is collected after making the substruct is complete then the finalizer gets run, which trashes the memory

Re: [racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Eric Dobson
Parsing it out in atomic mode probably will work, I'll look at that. The callback method I described is actually not how it works, and it is a bit more complicated (involving a separate place and blocking foreign calls), but I can do all of the decomposing work in atomic mode. I think I'm avoiding

Re: [racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Matthew Flatt
Is the work to parse out the values short enough that you can do it atomically in response to the notification that says the data is ready? If so, it's probably best to parse and free in atomic mode. Or can you at least atomically separate out references to children, where finalizers can sensibly

[racket-users] Best way to destruct objects allocated with "atomic interior" malloc

2017-10-03 Thread Eric Dobson
I'm dealing with some foreign apis that want to be passed long lived output pointers to structs. The apis eventually call back indicating that the struct has been filled in appropriately and then I want to read out the values and deallocate the structs. I'm using atomic interior memory for these

Re: [racket-users] Connecting a language and its reader

2017-10-03 Thread Matthew Butterick
> On Oct 1, 2017, at 12:50 PM, Jordan Johnson wrote: > > Correct me if I’m wrong in this understanding: the #'(module ...) is > effectively replacing the body of whatever program is written in #lang > mylang, so the path-string "semantics.rkt" must be interpreted

Re: [racket-users] Access pattern variable in macro

2017-10-03 Thread 'Shakin Billy' via Racket Users
Thanks a lot. Am 03.10.2017 9:05 nachm. schrieb "Matthew Butterick" : > > > On Oct 3, 2017, at 10:31 AM, 'Shakin Billy' via Racket Users < > racket-users@googlegroups.com> wrote: > > > > how do i access the pattern variable var at compile time (phase 1?) > > additional to an

Re: [racket-users] Access pattern variable in macro

2017-10-03 Thread Matthew Butterick
> On Oct 3, 2017, at 10:31 AM, 'Shakin Billy' via Racket Users > wrote: > > how do i access the pattern variable var at compile time (phase 1?) > additional to an answer, could you point me to the right part of the > documentation? i really couldn't find it.

[racket-users] Access pattern variable in macro

2017-10-03 Thread 'Shakin Billy' via Racket Users
hello, how do i access the pattern variable var at compile time (phase 1?) additional to an answer, could you point me to the right part of the documentation? i really couldn't find it. #lang racket (define inp (open-input-string "12+34")) (define-syntax (terminal stx) (syntax-case stx ()

Re: [racket-users] Confusing typed/racket error message

2017-10-03 Thread Sam Tobin-Hochstadt
Yes, that's definitely a bad error message, so we should try to improve Typed Racket here. Sam On Tue, Oct 3, 2017 at 12:54 PM, Taahir Ahmed wrote: > Of course it's something simple like that. You are correct, I changed > it to `#:replacement?` and then the program

Re: [racket-users] Confusing typed/racket error message

2017-10-03 Thread Taahir Ahmed
Of course it's something simple like that. You are correct, I changed it to `#:replacement?` and then the program typechecked and ran. It would be helpful if the error message showed me that I was passing extra arguments in the domain of the function, but at least now I know what was happening.

Re: [racket-users] Confusing typed/racket error message

2017-10-03 Thread Shu-Hung You
Hi Taahir, The keyword is #:replacement? instead of #:replacement (note the question mark). I don't know enough Typed Racket to understand that error message tho, sorry. Cheers, Shu-Hung On Tue, Oct 3, 2017 at 1:40 AM, Taahir Ahmed wrote: > Hi, > > I have been

RE: [racket-users] repeated code in interactions of scribble

2017-10-03 Thread Jos Koot
Hi Ben Greenman Unsyntaxed elemtag and elemref work well in code:comment. I did this as follows: #lang scribble/manual @require[scribble/example] @(define my-eval (make-base-eval)) Beginning. @examples[#:eval my-eval (code:comment #,(elemtag "plus2" "")) (define (plus2 n) (+ 2 n))

[racket-users] Confusing typed/racket error message

2017-10-03 Thread Taahir Ahmed
Hi, I have been implementing some toy problems in typed/racket. However, I have hit a wall while trying to invoke `(random-sample)`. This example program: #lang typed/racket (require typed/racket/random) (define (example (limit : Integer) (count : Integer)) : (Listof