leif
2018-2-12 14:50:22

@mflatt What is going to happen with raco ctool and Racket modules made in C in Racket 7?


leif
2018-2-12 14:50:41

As far as I can tell it seems to not be in the current implementation.


mflatt
2018-2-12 18:35:07

@leif raco ctool is still there for racket7 = “the current Racket VM, but with a Racket-implemented expander”. For Racket-on-Chez, raco ctool will not do anything useful.


mflatt
2018-2-12 18:36:56

Oh, it’s possible that I haven’t set up the part that can load a C implementation of a module in racket7, which is probably what you mean. I’ll have to look into that.


leif
2018-2-12 18:53:29

Yup, that is what I was trying to get at. I was talking with @michael.ballantyne about it.


leif
2018-2-12 18:54:03

(I noticed that I could us swig to generate c++ bindings for Racket, but it used the sort of C-level Racket modules to do so.)


abmclin
2018-2-12 18:58:58

@leif I hadn’t heard of swig before. I likely will need to use a C++ library for my Racket project and was dreading needing to create a C wrapper for it so swig may be my knight in shining armor.


leif
2018-2-12 19:10:36

@abmclin Hopefully it does help.


leif
2018-2-12 19:11:04

Obviously it does have to work by generating C wrappers. But swig does at least support racket directly. (Although it still refers to it as mzscheme)


abmclin
2018-2-12 19:28:27

I noticed that part too, I’ll give it a try and see how it goes :crossed_fingers:


leif
2018-2-12 19:28:38

g’luck


samth
2018-2-13 00:45:01

Swig was created by one of my professors from undergrad


leif
2018-2-13 00:55:11

@samth That’s pretty cool.


leif
2018-2-13 00:55:38

I wonder what the chances of adding a different flag for ‘racket’ (then the existing mzscheme one)


lexi.lambda
2018-2-13 01:52:39

What is the easiest way to create a synchronizable event that is just like an existing synchronizable event, but after it first becomes ready for synchronization, it stays ready for synchronization and its result is cached? Sort of like a promise, but for events?


lexi.lambda
2018-2-13 01:58:10

It seems like I can get what I want with the following: #lang racket (define (promise-evt evt) (let ([sem (make-semaphore)] [val #f]) (thread (λ () (set! val (sync evt)) (semaphore-post sem))) (wrap-evt (semaphore-peek-evt sem) (λ (evt) val)))) (define chan (make-channel)) (define one-time-chan-evt (promise-evt chan)) (thread (λ () (sleep 2) (channel-put chan 'hello))) (sync one-time-chan-evt) (sync one-time-chan-evt) …which waits 2 seconds, then prints 'hello twice, but I’m wondering if I’m overlooking a better way.


lexi.lambda
2018-2-13 02:01:30

In fact, what I am really trying to build here is an abstraction that represent a box to be filled in later by another thread, but it will only ever be empty for one continuous period, and then it will be filled forever. Again, sort of like a promise, except it is explicitly resolved by an imperative update by a producer thread.


abmclin
2018-2-13 02:07:38

Why not just create a filled box and return it through a channel, then throw away the channel since you won’t need to use it again. It seems unnecessary to need to sync repeatedly if the value never changes.


lexi.lambda
2018-2-13 02:08:19

Multiple threads might wish to synchronize on the same event.


abmclin
2018-2-13 02:19:16

Ahh ok so sync would be the preferred way to coordinate the threads


abmclin
2018-2-13 02:19:52

The promise-evt approach seems good to me. I’m wondering if could remove the need for a thread in the promise-evt definition


dedbox
2018-2-13 02:57:46

I found a thread-less version, FWIW


dedbox
2018-2-13 02:58:06

(sorry, addicted to sync)


dedbox
2018-2-13 02:58:18

In redex, is it possible to specify or render judgments that look like this? e_1 --> e_1* -------------------- E-App1 e_1 e_2 --> e_1* e_2


dedbox
2018-2-13 03:00:00

Also, is it possible to render normal primes instead of subscripted asterisks?


lexi.lambda
2018-2-13 03:14:51

@dedbox I’d be curious to see a threadless implementation.


dedbox
2018-2-13 03:51:50
(define (promise-evt evt)
  (let ([sem (make-semaphore 0)]
        [val #f])
    (choice-evt
      (handle-evt (semaphore-peek-evt sem) (λ _ val))
      (replace-evt evt (λ (v)
                         (set! val v)
                         (semaphore-post sem)
                         never-evt)))))

dedbox
2018-2-13 03:53:55

Maybe the semaphore needs some fiddling to avoid a race