On this page:
impo
impo.macro
impo.modifier
impo_  meta.Parsed
impo_  meta.After  Prefix  Parsed
impo_  meta.After  Infix  Parsed
impo_  meta.Parsed  Modifier
8.12
7.13.1 Import Macros🔗ℹ

space

impo

The space for bindings of identifiers that can be used within import for imports and import modifiers.

Like expr.macro, but defines a macro for use in import.

impo.macro 'rkt $(name :: Identifier) $('/ $(next :: Identifier)') ...':

  let str = to_string(name).append("/" +& next, ..., ".rkt")

  'lib($(Syntax.make(str, name)))'

> import:

    rkt racket/base

> base.add1(1)

2

definition

impo.modifier prefix_macro_patterns

 

option

 = 

~op_stx: id

 | 

~op_stx id

 | 

~import: imp_id

 | 

~import imp_id

Like defn.macro, but defines an identifier as an import modifier, and an optional ~import declaration provides an imp_id to be bound to the (opaque) import that is being modified.

impo.modifier 'as_rkt: $(name :: Identifier); ...':

  'rename:

     $name as $(Syntax.make_id("rkt_" +& name, name))

     ...'

> import:

    lib("racket/base.rkt"):

      as_rkt:

        add1

        sub1

> base.rkt_sub1(base.rkt_add1(1))

1

impo.modifier 'expose_as_rkt: $(name :: Identifier); ...':

  ~import imp

  let '$(ex_imp :: impo_meta.ParsedModifier(imp))':

    'expose: $name; ...'

  let '$(rn_imp :: impo_meta.ParsedModifier(ex_imp))':

    'as_rkt: $name; ...'

  rn_imp

> import:

    lib("racket/base.rkt"):

      expose_as_rkt:

        add1

        sub1

> rkt_sub1(rkt_add1(1))

1

syntax class

syntax_class impo_meta.Parsed:

  kind: ~group

  fields:

    group

 

syntax class

syntax_class impo_meta.AfterPrefixParsed(op_name):

  kind: ~group

  fields:

    group

    [tail, ...]

 

syntax class

syntax_class impo_meta.AfterInfixParsed(op_name):

  kind: ~group

  fields:

    group

    [tail, ...]

Provided as meta.

Analogous to expr_meta.Parsed, expr_meta.AfterPrefixParsed, , and expr_meta.AfterInfixParsed, but for imports.

syntax class

syntax_class impo_meta.ParsedModifier(imp):

  kind: ~group

  fields:

    group

Analogous to expr_meta.Parsed, but parses an import modifier applied to an import. The result is a parsed modified import.