samth
2019-4-5 15:15:22

@pocmatos what’s the easiest way to replicate the bug in #2018?


pocmatos
2019-4-5 15:16:59

Unfortunately there’s no easy way unless you have hardware access. Do you have access to any non intel hardware?


pocmatos
2019-4-5 15:18:36

Alternatively you can setup a qemu environment. I can help with that.


pocmatos
2019-4-5 15:19:22

For that you’d probably need access to linux or linux through docker.


pocmatos
2019-4-5 15:20:40

@samth ^^^


pocmatos
2019-4-5 15:21:26

It’s almost dinner time around here so I will soon have to go feed the children but when I come back we get repro this together.


samth
2019-4-5 15:29:31

linux is not a problem :slightly_smiling_face:


samth
2019-4-5 15:29:47

I don’t have any non-intel hardware


greg
2019-4-5 15:50:27

Also the correct response text is “OK” not “Okay” and I am willing to die on that hill. :smile:


greg
2019-4-5 15:50:59

So I like that part.


leif
2019-4-5 16:53:36

Does anyone know why this program actually works?:

#lang racket

(module* editor racket
  (require syntax/location)
  (define this-ns (current-namespace))
  (define ns (make-base-namespace))
  (parameterize ([current-namespace ns])
    (namespace-attach-module-declaration this-ns (quote-module-path ".." foo))
    (namespace-require/expansion-time (quote-module-path ".." foo))
    (eval 'y)))

(module* foo racket
  (define y (let () 8))
  (provide y))

leif
2019-4-5 16:53:58

Especially since this one doesn’t (which is what I would have expected):

#lang racket

(module* editor racket
  (require syntax/location)
  (define this-ns (current-namespace))
  (define ns (make-base-namespace))
  (parameterize ([current-namespace ns])
    (namespace-attach-module-declaration this-ns (quote-module-path ".." foo))
    (namespace-require/expansion-time (quote-module-path ".." foo))
    (eval 'y)))

(module* foo racket
  (define y (let () (writeln "running") 8))
  (provide y))

leif
2019-4-5 16:55:05

The difference being the second to last line (define y (let () 8) vs (let () (writeln "running") 8).


leif
2019-4-5 16:55:26

About the only thing I was able to come up with was that it was the result of a compiler optimization?


soegaard2
2019-4-5 16:56:41

If so have you tried on both normal Racket and on Racket-on-Chez?


soegaard2
2019-4-5 16:58:48

Also what expression do I use to see the problem?


leif
2019-4-5 17:01:13

@soegaard2 I don’t currently have a racket-on-chez build running on my system. But I have tried it with older versions of racket to the sameresults.


leif
2019-4-5 17:01:38

Umm…in the repl you could run: (require (submod "<filename.rkt>" editor))


leif
2019-4-5 17:01:51

Which should run the editor submodule.


soegaard2
2019-4-5 17:04:04

Does it help if you give eval an explicit namespace?


soegaard2
2019-4-5 17:05:33

Hmm - the evaluated expression is just a reference. How can that go wrong?!?


soegaard2
2019-4-5 17:07:00

Does (namespace-require/expansion-time (quote-module-path ".." foo)) mean you are only attaching the module at phase 1 -


soegaard2
2019-4-5 17:07:09

and the evaluation takes place at phase 0?


leif
2019-4-5 17:07:30

@soegaard2 So, if you don’t give eval a namespace, it defaults to current-namespace, which I set explicitly to a new base namespace.


leif
2019-4-5 17:08:25

Also yes, namespace-require/expansion-time only visits the module, not instantiate it. (I might have that backwards…but yes, it only runs the phase 1 stuffs.)


soegaard2
2019-4-5 17:08:42

Now I get why you are surprised the first program works.


leif
2019-4-5 17:09:05

Ya, basically. I suspect @mflatt might know something.


leif
2019-4-5 17:09:22

If you have a racket-on-chez build on your current system, wanna see what it does?


soegaard2
2019-4-5 17:10:14

Haven’t yet - but this is a nice excuse to install it.


leif
2019-4-5 17:13:09

Oh. You can install it these days without compiling it yourself?


leif
2019-4-5 17:13:12

That’s pretty cool.


leif
2019-4-5 17:19:56

I mean, its certainly ‘related’ to compiler optimizations. (Given that (let () 8) can be easily compiled to just 8…(at least in this context), but the real question is why are constants run…


soegaard2
2019-4-5 17:24:24

(define y (begin 1 2))


soegaard2
2019-4-5 17:24:27

works fine


leif
2019-4-5 17:25:24

Yup. Because that get’s compiled to (define-values (x) 2)


leif
2019-4-5 17:25:31

(Which you can test by using raco decompile


leif
2019-4-5 17:26:18

Basically:

(module simp racket
  (#%plain-module-begin
   (define x (begin 1 2))))

leif
2019-4-5 17:26:33
$ raco make simp.rkt && raco decompile simp.rkt
(module simp ....
  (require (lib "racket/main.rkt"))
  (provide)
  (define-values (x) '2)
  (void))

notjack
2019-4-5 18:27:41

I think http/2 doesn’t even send the status message