It seems to work ... i.e. returns #<void> ... in Windows.  I tried it in 7.6 and 7.7,  both 32 and 64 bit versions.   Not near my Linux machine to try it there.

The expansion in all cases is the same and seems reasonable:

   (module count racket
      (#%module-begin
       (module configure-runtime '#%kernel
         (#%module-begin (#%require racket/runtime-config) (#%app
   configure '#f)))
       (#%provide count!)
       (define-values
        (lifted/2)
        (begin
          (with-continuation-mark
           contract-continuation-mark-key
           (#%app cons idB12 'no-negative-party)
           (let-values ()
             (#%app
              idX9
              (#%app
               module-name-fixup
               (#%app
                variable-reference->module-source/submod
                (#%variable-reference))
               (#%app list)))))))
       (define-values
        (count!)
        (let-values (((i) '0))
          (lambda () (begin0 (set! i (#%app add1 i)) (#%app lifted/2
   i)))))))



Btw:  my Racket installations report only  "7.7", not  "7.7.0.5". Are you running a snapshot build?

George


On 6/17/2020 3:04 AM, Sage Gerard wrote:
I attached a video demonstrating what I'm seeing. In case it does not load or is not available, I'll summarize here. Forgive any typos; it's been a late night of coding.

Here's a module with an incorrect counter. It's incorrect because it uses begin0, and is therefore expected to return void instead of an incrementing integer.

#lang racket
(provide count!)
(define count!
  (let ([i 0])
    (λ () (begin0
            (set! i (add1 i))
            (~v i)))))

Notice that I added the ~v to format the return value. If I launch Racket v7.7.0.5 using racket -it prog.rkt, (count!) returns the formatted value. But if I remove the ~v, it behaves as written (returning void).

The video shows the behavior with and without ~v, both in DrRacket and racket. DrRacket is the only environment that consistently runs the code correctly.


--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/626cee23-fa67-c17f-781c-44554a50cf2e%40comcast.net.

Reply via email to