guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New syntax: (: MODULE-NAME VARIABLE-NAME)


From: Marius Vollmer
Subject: New syntax: (: MODULE-NAME VARIABLE-NAME)
Date: Thu, 13 Nov 2003 19:12:01 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

Hi,

what about making the changes below?  The only unclean thing is that
we would need to change the interpretation of a single ':'.  The colon
is such a natural choice, but we could avoid that uncleanliness by
using some other symbol.  Which one?

    ** The '-e' option now 'read's its argument.

    This is to allow the new '(: MODULE-NAME VARIABLE-NAME)' construct to
    be used with '-e'.  For example, you can now write a script like

      #! /bin/sh
      exec guile -e '(: (demo) main)' -s "$0" "$@"
      !#

      (define-module (demo)
        :export (main))

      (define (main args)
        (format #t "Demo: ~a~%" args))

    ** A single ':' is always a symbol.

    Even with (read-set! keywords 'prefix).  If you really want a keyword
    of length zero, write '#:'.

    ** New syntax ':':

    You can now directly refer to variables in a module by writing

        (: MODULE-NAME VARIABLE-NAME)

    For example (: (ice-9 pretty-print) pretty-print) will directly
    access the pretty-print variable in the (ice-9 pretty-print) module.
    You don't need to 'use' that module first.  You can also use ':' with
    'set!'.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

[Prev in Thread] Current Thread [Next in Thread]