lexi.lambda
2018-4-13 15:37:02

@mflatt The documentation for syntax-local-definition-context makes the following claim:

> If intdef-ctx is not #f, then the new internal-definition context extends the given one. An extending definition context adds all scopes that are added by intdef-ctx, and expanding in the new internal-definition context can use bindings previously introduced into intdef-ctx.

However, the output of the following program appears inconsistent with that claim on both Racket 6.12 and Racket 7:

#lang racket
(begin-for-syntax
  (define ctx1 (syntax-local-make-definition-context))
  (define ctx2 (syntax-local-make-definition-context ctx1))

  (define stx (datum->syntax #f #f))

  (println (hash-ref (syntax-debug-info stx) 'context))
  (println (hash-ref (syntax-debug-info (internal-definition-context-introduce ctx1 stx)) 'context))
  (println (hash-ref (syntax-debug-info (internal-definition-context-introduce ctx2 stx)) 'context))

  (newline)

  (define stx2 #'(quote #f))
  (println (hash-ref (syntax-debug-info (local-expand stx2 'expression '())) 'context))
  (println (hash-ref (syntax-debug-info (local-expand stx2 'expression '() ctx1)) 'context))
  (println (hash-ref (syntax-debug-info (local-expand stx2 'expression '() ctx2)) 'context)))
'()
'(#(2986 intdef))
'(#(2987 intdef))

'(#(9 module) #(2320 module intdef-scopes))
'(#(9 module) #(2320 module intdef-scopes) #(2986 intdef))
'(#(9 module) #(2320 module intdef-scopes) #(2987 intdef))

In the case of both internal-definition-context-introduce and local-expand, the scope from the child definition context is added, but the scope from the parent context is not. Is this consistent with the documentation and I am just misunderstanding something, or is either the documentation or implementation incorrect?


lexi.lambda
2018-4-13 15:37:46

I would test on Racket 6.2 as well, but I don’t know if there’s an equivalent to syntax-debug-info.


lexi.lambda
2018-4-13 15:49:16

Is it possible this has never worked? The following program fails with an unbound identifier error about plus on 6.2, 6.12, and HEAD: #lang racket (require syntax/parse/define) (define-simple-macro (with-plus form:expr) #:with plus (datum->syntax #'form 'plus) #:do [(define ctx1 (syntax-local-make-definition-context)) (syntax-local-bind-syntaxes (list #'plus) #'(make-rename-transformer #'+) ctx1) (internal-definition-context-seal ctx1) (define ctx2 (syntax-local-make-definition-context ctx1)) (internal-definition-context-seal ctx2)] #:with result (local-expand #'form 'expression '() ctx2) result) (with-plus (plus 1 2)) It does, however, successfully compile if the ctx2 argument to local-expand is changed to ctx1.


lexi.lambda
2018-4-13 15:54:18

As far as I can tell, there are exactly zero tests for a use of syntax-local-make-definition-context with a non-#f argument, and there is only one use of syntax-local-make-definition-context with a non-#f argument in the entire racket/racket repo. It is in a utility function in racket/syntax that is #f unless overridden by a user, so that doesn’t really count.


lexi.lambda
2018-4-13 16:38:05

Okay, I think I finally figured out what the argument is intended to do—it affects what’s in scope on the RHS of definitions bound using syntax-local-bind-syntaxes, not when the context is used with local-expand.


cosmez
2018-4-13 17:02:20

is there a way to send the selected sexp to the interactions window in DrRacket?


lexi.lambda
2018-4-13 19:12:33

@ryanc Am I hallucinating, or is macro hiding in the macro stepper working again? (Or at least working better?)


spdegabrielle
2018-4-13 19:34:44

@cosmez I think that would be pretty easy in Quickscript http://docs.racket-lang.org/quickscript/index.html


cosmez
2018-4-13 20:46:27

thanks, ill check it out!


leif
2018-4-13 21:29:54

@mflatt Since Racket’s gui using libpaingo for font rendering, and libcairo for drawing, would it be a terrible idea to also use libatk for screen reader support?


leif
2018-4-13 21:30:00

(Since DrRacket currently has none)


leif
2018-4-13 21:30:37

Or would there be a vehement push against using another native library, and to use a use a separate solution for each os?