mflatt
2019-3-29 13:48:21

The way to remove scopes is via make-syntax-delta-introducer, but it does sound like quasisyntax was the wrong tool to start with in this case. I’m not clear on what scopes you mean to add (on which subforms) and which ones are unwanted.


343519265
2019-3-29 14:06:59

Personally, on MacOS, I merge consecutive wheel events into one (by adjusting wheel-step) in every 200ms, though the overall performance of DrRacket is still much slower than on Linux, it do avoid the unresponsive problems while scrolling large files.


pocmatos
2019-3-29 14:07:06

@samth the reduced version from 2569, was this generated using demodularize + full expand?


samth
2019-3-29 14:07:40

That’s generated from the extraction tool used for bootstrapping the expander (see racket/src/expander/README)


pocmatos
2019-3-29 14:08:10

Will take a look, thanks.


lexi.lambda
2019-3-29 17:32:25

@mflatt Is this behavior a bug? This program: #lang racket (parameterize ([current-namespace (make-base-namespace)]) (eval '(module m racket (define phase-0-mod-path (resolved-module-path-name (variable-reference->resolved-module-path (#%variable-reference)))) (define-syntax (quote-phase-1-mod-path stx) #`'#,(resolved-module-path-name (variable-reference->resolved-module-path (#%variable-reference)))) (define phase-1-mod-path (quote-phase-1-mod-path)) (printf " mod-path @ 0 = ~v\n" phase-0-mod-path) (printf " mod-path @ 1 = ~v\n\n" phase-1-mod-path) (printf " mod-paths equal? = ~v\n\n" (equal? phase-0-mod-path phase-1-mod-path)) (printf "mod-path interned? @ 0 = ~v\n" (symbol-interned? phase-0-mod-path)) (printf "mod-path interned? @ 1 = ~v\n" (symbol-interned? phase-1-mod-path)))) (eval '(require 'm))) prints: mod-path @ 0 = 'm mod-path @ 1 = 'm mod-paths equal? = #f mod-path interned? @ 0 = #t mod-path interned? @ 1 = #f I don’t have any idea if this is a bug, intentional, or unspecified behavior, but it is a little confusing.


lexi.lambda
2019-3-29 17:33:13

It also seems like it’s different from Racket 6.12, since on Racket 6.12 the paths are equal? (both are interned).


mflatt
2019-3-29 18:10:09

@lexi.lambda It’s intentionally inconvenient. A compile-time module path does not necessarily have anything to do with the run-time module path. The new expander uses an uninterned symbol that prints in a useful-for-debugging way but is meant to be consistently different from the run-time name.


lexi.lambda
2019-3-29 18:12:14

Got it, that makes sense. It came up when I was writing tests for https://github.com/racket/racket/pull/2554, and I wanted to make sure the right module was blamed, so I am looking at the value inside the blame-positive field of a blame object. I ended up doing this: https://github.com/racket/racket/blob/660107e0a9204e146994080189aeca1bca8aa6bd/pkgs/racket-test/tests/syntax/contract/phase.rkt#L23-L25 Is there a better way/is there something I should do instead?


mflatt
2019-3-29 18:37:10

I can think of anything better.


lexi.lambda
2019-3-29 18:39:39

I guess maybe the right thing to do in that case is to extract the actual module path from the module at the appropriate phase, but it’d be a little more effort. Maybe I’ll make that change.


soegaard2
2019-3-29 19:11:36

@343519265 Is this the code you use for DrRacket to merge consecutive wheel events?



lexi.lambda
2019-3-29 19:28:59

@mflatt Thinking about it some more, is there any particular reason module names at compile-time ignore current-module-declare-name? I realize that parameter is designed to affect, well, when a module is declared, but it does seem unnecessarily confusing that the expansion-time module name is sometimes very different… so maybe there could be something like that parameter that affects expansion-time? I guess the current approach makes things like phase 1 uses of quote-module-name conveniently work out, in that they will produce symbols instead of paths, which means bytecode that contains quoted versions of those paths will be machine-independent, but that seems more accidental than intentional.


notjack
2019-3-29 20:19:52

What are module names anyway? I don’t really understand the subtler points of how they relate to phases, file paths, the top level, and bytecode.


leif
2019-3-29 20:29:06

Oh cool. That actually seemed to work. (replacing quasisyntax with datum->syntax and using delta introducers. Thanks.


leif
2019-3-29 20:29:18

leif
2019-3-29 20:29:19

leif
2019-3-29 20:30:31

The syntax object inside of bar has one less scope than the one inside of foo.


leif
2019-3-29 20:30:48
#hasheq((context
         .
         (#(71034 module)
          #(71042 module anonymous-module)
          #(71606 macro)
          #(71607 use-site))))
#hasheq((context
         .
         (#(71034 module)
          #(71042 module anonymous-module)
          #(71607 use-site)
          #(71608 macro)
          #(71609 use-site))))

leif
2019-3-29 20:31:04

Is there any way to remove the second use site scope?


lexi.lambda
2019-3-29 20:31:07

You need to call syntax-local-introduce before calling syntax-debug-info to see the “outside” view instead of the “inside” view.


leif
2019-3-29 20:31:36

@lexi.lambda Ya, but iirc that only removes the macro scope.


lexi.lambda
2019-3-29 20:31:54

Oh, sure. You can’t arbitrarily get rid of use-site scopes.


leif
2019-3-29 20:32:32

But isn’t that a problem when you have a macro that expands to another macro (use) that wants to bind a new variable?


lexi.lambda
2019-3-29 20:32:51

No, because use-site scopes are pruned by the expander when it binds a variable in a definition context.


leif
2019-3-29 20:32:53

err….other way


leif
2019-3-29 20:33:08

err…never mind, the original way.


lexi.lambda
2019-3-29 20:33:11

You can prune some use-site scopes off of identifiers using syntax-local-identifier-as-binding. But that only works on identifiers, since you’re only supposed to use it if you’re implementing your own definition context-like expansion loop.


lexi.lambda
2019-3-29 20:33:39

lexi.lambda
2019-3-29 20:34:13

Specifically, see that section and the next one.


leif
2019-3-29 20:34:26

OH. So this is a limitation of @stchang’s and Sam C.’s trick to extend environments in turnstyle.


lexi.lambda
2019-3-29 20:34:28

Section 2.4 explains the pruning of use-site scopes.


lexi.lambda
2019-3-29 20:35:01

I don’t know what you mean, but I don’t think turnstile should be negatively impacted by this, though it may need to call syntax-local-identifier-as-binding in certain places.


lexi.lambda
2019-3-29 20:35:14

It’s possible it currently doesn’t do that, but should.


leif
2019-3-29 20:35:20

(because we’ve been local-expanding it in an ‘expression’ context, which obviously isn’t a binding one.


leif
2019-3-29 20:35:56

Nah, that’s almost certainly how to get around it.


lexi.lambda
2019-3-29 20:36:03

If you’re expanding an expression, you should expand it in an expression context, yes… but then use-site scopes shouldn’t affect you, since you’re in an expression context.


leif
2019-3-29 20:36:09

I think that you answered my question (without realizing it) so thanks. :smile:


lexi.lambda
2019-3-29 20:36:15

Use-site scopes only come into play when you’re expanding in a definition context.


leif
2019-3-29 20:37:17

THe overall macro is in a definition context.


lexi.lambda
2019-3-29 20:44:06

Then yes, you’d get a use-site scope. But the use-site scope should go everywhere, so it shouldn’t matter if the thing you’re expanding is an expression.


asumu
2019-3-30 00:26:41

Has anyone made a redex model of wasm yet?


notjack
2019-3-30 00:49:00

or a #lang for that matter


notjack
2019-3-30 00:49:27

The text format of wasm uses s-expressions so it should be really easy


343519265
2019-3-30 01:27:29

Yes, it is


343519265
2019-3-30 02:48:24

another attempt is https://github.com/yjqww6/useless/blob/master/gadgets/tool-wheel2.rkt, didn’t feel a significant difference.