Next: , Previous: , Up: iklib syntaxes   [Index]


6.8.19 Miscellaneous syntaxes

Syntax: endianness ?endianness-symbol

Extend the syntax defined by R6RS. The name of ?endianness-symbol must be a symbol describing an endianness. Supported symbols are big, little, network an native; network is converted to big, native is converted to the return value of (native-endianness).

Fluid Syntax: __who__

A fluid syntax to be bound to the quoted name of the function being executed; it can be used as argument for the &who condition object. It is meant to be used as follows:

(define (func arg)
  (fluid-let-syntax
      ((__who__ (identifier-syntax (quote func))))
    ---))
Fluid Syntax: __synner__

A fluid syntax to be bound to the synner function in syntax transformers.

Fluid Syntax: this

A fluid syntax to be bound to the “subject” of a method procedure. It is meant to be used as follows: given the record method definition:

(define-record-type <duo>
  (fields one two)
  (method (add)
    (+ (.one this) (.two this))))

the method’s implementation procedure is defined as:

(define (<duo>-add {subject <duo>})
  (fluid-let-syntax
      ((this (make-synonym-transformer #'subject)))
    (+ (.one this) (.two this))))
Identifier Syntax: __file__

Expand to a quoted string representing the source code location, for example the source file pathname.

Identifier Syntax: __line__

Expand to #f or a number representing the line number.

Fluid Syntax: brace

A fluid syntax which is free to be bound to whatever user code needs. When the Scheme code reader is in #!vicare mode: brace lists are read as brace forms as follows:

{}              → (brace)
{1 2 3}         → (brace 1 2 3)
{1 . 2}         → (brace 1 . 2)
Fluid Syntax: <>

A fluid syntax which is free to be bound to whatever user code needs. It is meant to be a placeholder for some expression defined by the local context; for example: it is used by the syntaxe is-a?

Syntax: begin-for-syntax ?body0 ?body

Evaluate the ?body forms at expand time; these syntaxes count as definitions in a body. Notice that definitions in the body are visible by other code evaluated for expand:

(begin-for-syntax
  (define a 1))

(begin-for-syntax
  (define b 2))

(begin-for-syntax
  (define c (+ a b)))

(define-syntax (doit stx)
  #`(quote (#,a #,b #,c)))

(doit)          ⇒ (1 2 3)
Syntax: expand-time-expr ?expr

Evaluated the expression ?expr at expand–time, expecting it to return a syntax object; then expand such syntax object and insert the result in the invoke code. This syntax can be used both in definition context and in expression context.

(expand-time-expr 1)
→ 1

(expand-time-expr #'1)
→ 1

(expand-time-expr #'(define a 1))
a   ⇒ 1
Syntax: set-cons! ?who ?obj

Expand to:

(set! ?who (cons ?obj ?who))
Syntax: values->list ?expr

Evaluate the expression and return its return values as a list. Examples:

(values->list 123)
⇒ (123)

(values->list (values 1 2 3))
⇒ (1 2 3)

Next: , Previous: , Up: iklib syntaxes   [Index]