Illegal use of syntax value at phase 1

hello,

i have this strange error, related with SRFI 105 (infix curly expression) i admit but the error comes from Racket language not the SRFI 105 reader.

In this macro (i quoted the body for debug) :

(define-syntax $bracket-apply$
  (syntax-rules ()
    
    ((_ container index)
    
     (cond ((vector? container) '(if (equal? (quote :) (quote index))
				    container ;; return the vector
				    (vector-ref container index))) ;; return an element of the vector
	   ((hash-table? container) (hash-table-ref container index))
	   ((string? container) (string-ref container index))
	   (else (array-ref container index))))

and when testing i got this error:

Welcome to DrRacket, version 8.9 [cs].
Language: reader "../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/SRFI/SRFI-105-toplevel.rkt", with debugging; memory limit: 8192 MB.
> {z <+ #(1 2 3 4 5)}
'#(1 2 3 4 5)
> {z[2]}
'(if (equal? ': '2) z (vector-ref z 2))
> {z[:]}
:: illegal use of syntax
  value at phase 1: #<generator> in: :
> (define (:) 7)
> (:)
7
> '{z[:]}
'($bracket-apply$ z :)
> ($bracket-apply$ z :)
'(if (equal? ': ':) z (vector-ref z :))

you will notice there is no error if i use prefix syntax ,error is only when the reader SRFI 105 is used in {z[:]} , error is related with colon : but does not come from reader itself, : does not seems to be a reserved character in Racket.

I do not understand, so any help is greatly appreciated...

Regards,

Damien

note that the same code works in Guile :

scheme@(guile-user)>  (use-modules (Scheme+))
;;; note: source file /usr/local/share/guile/site/3.0/Scheme+.scm
;;;       newer than compiled /Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/Scheme+.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /usr/local/share/guile/site/3.0/Scheme+.scm
;;; note: source file /usr/local/share/guile/site/3.0/growable-vector.scm
;;;       newer than compiled /Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/growable-vector.scm.go
;;; compiling /usr/local/share/guile/site/3.0/growable-vector.scm
;;; compiled /Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/growable-vector.scm.go
;;; compiled /Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/Scheme+.scm.go
scheme@(guile-user)> {z <+ #(1 2 3 4 5)}
$1 = #(1 2 3 4 5)
scheme@(guile-user)> {z[2]}
$2 = 3
scheme@(guile-user)> {z[:]}
;;; <stdin>:4:3: warning: possibly unbound variable `:'
$3 = #(1 2 3 4 5)

i suppose the racket behavior has something to see with the infix reader that use this at beginning:

(require syntax/strip-context)

(provide (rename-out [literal-read read]
                     [literal-read-syntax read-syntax]))


(define (literal-read in)
  (syntax->datum
   (literal-read-syntax #f in)))
 
(define (literal-read-syntax src in)
  
  (define lst-code (process-input-code-tail-rec in))

  (strip-context `(module anything racket/load ,@lst-code))) ;; this force a TOPLEVEL behavior !

i tried to remove the toplevel behavior with removing racket/load and using racket but it change nothing, perheaps the concernis with (require syntax/strip-context)

ok replacing colon by another character like O make it works:

Welcome to DrRacket, version 8.9 [cs].
Language: reader "../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/SRFI/SRFI-105-toplevel.rkt", with debugging; memory limit: 8192 MB.
> {z <+ #(1 2 3 4 5)}
'#(1 2 3 4 5)
> {z[O]}
'#(1 2 3 4 5)
> 

but still no explanation

i want to use : like in python ,any idea?

I think what's happening is that : is already bound to an identifier that is a syntax error when used by itself. But it's hard to tell without being able to run your programs.

yes you are right, i was using the SRFI 42 Eager Comprehensions and the first thing defined in is the colon : defined in SRFI 42.

https://srfi.schemers.org/srfi-42/srfi-42.html

for syntax like this:

(list-ec (: i 5) (* i i)) => (0 1 4 9 16)

this is in conflict with my syntax.

thank you very much , this solve the problem.

Regards,

Damien