No, I don't think that this can be made to work with the current
sub-range-binders. The way DrRacket thinks about this is that those
are two different binders (symb and symb?), and you are renaming
either one of them or the other one. It can't connect them the way you
are seeming to want to connect them (if I'm understanding correctly?).

Robby


On Tue, Jul 14, 2015 at 11:50 AM, Jens Axel Søgaard
<jensa...@soegaard.net> wrote:
> Hi All,
>
> I am experimenting with the sub-range-binders syntax property.
>
> Given this program:
>
>     (define symb? symbol?)
>     (define-no? symb?)
>     symb
>
> I want to use DrRacket's renaming facility to rename the symb? in the second
> line to sym?.
>
> I expect to get this program:
>
>     (define sym? symbol?)
>     (define-no? sym?)
>     sym
>
> However I get this:
>
>     (define sym? symbol?)
>     (define-no? sym?)
>     sym?
>
> (notice the extra ? in the last line).
>
> Is this possible using sub-range-binders ?
>
> /Jens Axel
>
>
> #lang racket/base
> (require (for-syntax racket/base))
> (define-syntax (define-no? stx)
>   (syntax-case stx ()
>     [(_ id?)
>      (let ()
>        (define s (symbol->string (syntax-e #'id?)))
>        (define l1 (string-length s))
>        (define l2 (- l1 1))
>        (define id-str (substring s 0 l2))
>        (define id (datum->syntax #'id? (string->symbol id-str)))
>
>        (syntax-property #`(define #,id id?)
>                         'sub-range-binders (vector (syntax-local-introduce
> id)
>                                                    0 l2 0.5 0.5
>                                                    (syntax-local-introduce
> #'id?)
>                                                    0 l1 0.5 0.5)))]))
>
> (define symb? symbol?)
> (define-no? symb?)
> symb
>
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to