* New syntax: (: MODULE-NAME VARIABLE-NAME)
@ 2003-11-13 18:12 Marius Vollmer
2003-11-13 19:47 ` Neil Jerram
` (3 more replies)
0 siblings, 4 replies; 19+ messages in thread
From: Marius Vollmer @ 2003-11-13 18:12 UTC (permalink / raw)
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
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-13 18:12 New syntax: (: MODULE-NAME VARIABLE-NAME) Marius Vollmer
@ 2003-11-13 19:47 ` Neil Jerram
2003-11-13 20:58 ` Marius Vollmer
2003-11-14 22:09 ` Mikael Djurfeldt
` (2 subsequent siblings)
3 siblings, 1 reply; 19+ messages in thread
From: Neil Jerram @ 2003-11-13 19:47 UTC (permalink / raw)
Cc: guile-devel
>>>>> "Marius" == Marius Vollmer <mvo@zagadka.de> writes:
Marius> ** New syntax ':':
This sounds fun but I have one query ...
Marius> You don't need to 'use' that module first.
But a use of `:' on a module that hasn't been loaded yet will cause an
implicit `(use-modules ...)', won't it, which could in turn do
arbitrary evaluation? Is so, is this OK?
Neil
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-13 19:47 ` Neil Jerram
@ 2003-11-13 20:58 ` Marius Vollmer
2003-11-14 21:04 ` Neil Jerram
0 siblings, 1 reply; 19+ messages in thread
From: Marius Vollmer @ 2003-11-13 20:58 UTC (permalink / raw)
Cc: guile-devel
Neil Jerram <neil@ossau.uklinux.net> writes:
> Marius> You don't need to 'use' that module first.
>
> But a use of `:' on a module that hasn't been loaded yet will cause an
> implicit `(use-modules ...)', won't it, which could in turn do
> arbitrary evaluation? Is so, is this OK?
Good point. Hmm. We already have this kind of behavior with the
:autoload option. In any case, I think we can allow this. I'd say it
is somewhat like macros, you don't know when they are expanded
exactly, and you have to account for this. Likewise, you can't know
when a module is loaded, so you need to account for that, too.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-13 20:58 ` Marius Vollmer
@ 2003-11-14 21:04 ` Neil Jerram
2003-11-15 15:19 ` Marius Vollmer
0 siblings, 1 reply; 19+ messages in thread
From: Neil Jerram @ 2003-11-14 21:04 UTC (permalink / raw)
Cc: guile-devel
>>>>> "Marius" == Marius Vollmer <mvo@zagadka.de> writes:
Marius> Good point. Hmm. We already have this kind of behavior with the
Marius> :autoload option. In any case, I think we can allow this. [...]
OK. One other specification query: will `:' only work if the relevant
binding is exported?
Neil
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-13 18:12 New syntax: (: MODULE-NAME VARIABLE-NAME) Marius Vollmer
2003-11-13 19:47 ` Neil Jerram
@ 2003-11-14 22:09 ` Mikael Djurfeldt
2003-11-15 15:10 ` Marius Vollmer
2003-11-16 8:02 ` Dirk Herrmann
2003-11-17 14:44 ` New syntax (@ MODULE-NAME VARIABLE-NAME) committed Marius Vollmer
3 siblings, 1 reply; 19+ messages in thread
From: Mikael Djurfeldt @ 2003-11-14 22:09 UTC (permalink / raw)
Cc: djurfeldt, guile-devel
Marius Vollmer <mvo@zagadka.de> writes:
> what about making the changes below? The only unclean thing is that
> we would need to change the interpretation of a single ':'.
But isn't that pretty darn unclean? It changes the lexical structure
of the language. Note that we currently have an option which controls
whether the reader conforms to R5RS ("Extended alphabetic characters
may be used within identifiers as if they were letters.") or whether
colon is marking a keyword, and that this option is defaulted to R5RS.
I vote for using some syntax which is compatible with R5RS and would
urge you strongly to at least keep the possibility to be compatible
(=> new option controlling the interpretation of colon).
M
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-14 22:09 ` Mikael Djurfeldt
@ 2003-11-15 15:10 ` Marius Vollmer
2003-11-17 2:00 ` Mikael Djurfeldt
0 siblings, 1 reply; 19+ messages in thread
From: Marius Vollmer @ 2003-11-15 15:10 UTC (permalink / raw)
Cc: guile-devel
Mikael Djurfeldt <mdj@mit.edu> writes:
> Marius Vollmer <mvo@zagadka.de> writes:
>
>> what about making the changes below? The only unclean thing is that
>> we would need to change the interpretation of a single ':'.
>
> But isn't that pretty darn unclean? It changes the lexical structure
> of the language.
Hmm, yes and no. With the change, ':' remains a variable identifier
and the new syntax is actually a macro:
(define-macro (: mod-name var-name)
(let ((var (module-variable (resolve-interface mod-name) var-name)))
(if (not var)
(error "no such public variable" (list ': mod-name var-name)))
var))
That part is clean, I think, and doesn't change the lexical structure.
It only depends on an implementational detail and does something
officially that you can't do in Standard Scheme. However, Standard
Scheme doesn't have a module system either, and from that point of
view 'use-modules' etc already has changed the lexical structure
significantly.
> Note that we currently have an option which controls
> whether the reader conforms to R5RS ("Extended alphabetic characters
> may be used within identifiers as if they were letters.") or whether
> colon is marking a keyword, and that this option is defaulted to R5RS.
The reader is unchanged in the R5RS mode, only the non-R5RS mode now
treats an isolated colon differently:
;; R5RS
guile> (symbol? ':)
#t
guile> (keyword? '#:)
#t
;; non-R5RS with the change
guile> (read-set! keywords 'prefix)
guile> (symbol? ':)
#t
guile> (keyword? '#:)
#t
;; non-R5RS without the change
guile> (read-set! keywords 'prefix)
guile> (symbol? ':)
#f
guile> (keyword? ':)
#t
> I vote for using some syntax which is compatible with R5RS and would
> urge you strongly to at least keep the possibility to be compatible
> (=> new option controlling the interpretation of colon).
Given that the syntax is compatible, do you think we still need an
option for making (keyword ':) true again?
Here are the ChangeLog entries for the actual changes:
2003-10-24 Marius Vollmer <mvo@zagadka.de>
* read.c (scm_lreadr): Treat a single ':' always a symbol,
never as an empty keyword.
2003-10-23 Marius Vollmer <mvo@zagadka.de>
* eval.c (scm_m_generalized_set_x): Macroexpand the target when it
is a list. This allows (: ...) to work with set!.
* script.c (scm_compile_shell_switches): Use scm_c_read_string for
the "-e" option instead of scm_str2symbol. This allows things
like (: ...) to be specified for the entry point.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-14 21:04 ` Neil Jerram
@ 2003-11-15 15:19 ` Marius Vollmer
2003-11-15 19:22 ` Neil Jerram
0 siblings, 1 reply; 19+ messages in thread
From: Marius Vollmer @ 2003-11-15 15:19 UTC (permalink / raw)
Cc: guile-devel
Neil Jerram <neil@ossau.uklinux.net> writes:
> OK. One other specification query: will `:' only work if the relevant
> binding is exported?
Yes, I think that's more disciplined. Here is the actual code:
;; The following macro allows one to write, for example,
;;
;; (: (ice-9 pretty-print) pretty-print)
;;
;; to refer directly to the pretty-print variable in module (ice-9
;; pretty-print). It works by looking up the variable and inserting
;; it directly into the code. This is understood by the evaluator.
;; Indeed, all references to global variables are memoized into such
;; variable objects.
(define-macro (: mod-name var-name)
(let ((var (module-variable (resolve-interface mod-name) var-name)))
(if (not var)
(error "no such public variable" (list ': mod-name var-name)))
var))
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-15 15:19 ` Marius Vollmer
@ 2003-11-15 19:22 ` Neil Jerram
2003-11-16 17:31 ` Marius Vollmer
0 siblings, 1 reply; 19+ messages in thread
From: Neil Jerram @ 2003-11-15 19:22 UTC (permalink / raw)
Cc: guile-devel
>>>>> "Marius" == Marius Vollmer <mvo@zagadka.de> writes:
Marius> Neil Jerram <neil@ossau.uklinux.net> writes:
>> OK. One other specification query: will `:' only work if the relevant
>> binding is exported?
Marius> Yes, I think that's more disciplined.
For most uses I agree, but what about debugging (or introspection)
code, where it might be useful to say things like
(break! (: (ice-9 whatnot) internal-proc))
where internal-proc is not exported. Obviously a `:'-like macro for
non-exported bindings could be implemented separately (I think it just
needs resolve-module instead of resolve-interface), but I wonder if
it's worth designing an interface now that neatly covers both
possibilities.
For example:
(: MOD-NAME VAR-NAME) -> look up from exported bindings only
(: MOD-NAME VAR-NAME internal) -> look up from all bindings
Regards,
Neil
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-13 18:12 New syntax: (: MODULE-NAME VARIABLE-NAME) Marius Vollmer
2003-11-13 19:47 ` Neil Jerram
2003-11-14 22:09 ` Mikael Djurfeldt
@ 2003-11-16 8:02 ` Dirk Herrmann
2003-11-17 14:44 ` New syntax (@ MODULE-NAME VARIABLE-NAME) committed Marius Vollmer
3 siblings, 0 replies; 19+ messages in thread
From: Dirk Herrmann @ 2003-11-16 8:02 UTC (permalink / raw)
Cc: guile-devel
Marius Vollmer wrote:
>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?
>
Hi,
I think it would be nice to have such a shortcut. However, there is a
problem we should consider first, before providing such a thing: Do you
mean ':' to refer to syntactic bindings also? This would influence the
memoizing phase, when memoizing is separately performed before execution.
Best regards
Dirk
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-15 19:22 ` Neil Jerram
@ 2003-11-16 17:31 ` Marius Vollmer
2003-11-16 18:20 ` Neil Jerram
0 siblings, 1 reply; 19+ messages in thread
From: Marius Vollmer @ 2003-11-16 17:31 UTC (permalink / raw)
Cc: guile-devel
Neil Jerram <neil@ossau.uklinux.net> writes:
> >> OK. One other specification query: will `:' only work if the relevant
> >> binding is exported?
>
> Marius> Yes, I think that's more disciplined.
>
> For most uses I agree, but what about debugging (or introspection)
> code, [...]
Yes, that would be useful as well.
> Obviously a `:'-like macro for non-exported bindings could be
> implemented separately (I think it just needs resolve-module instead
> of resolve-interface), but I wonder if it's worth designing an
> interface now that neatly covers both possibilities.
>
> For example:
> (: MOD-NAME VAR-NAME) -> look up from exported bindings only
> (: MOD-NAME VAR-NAME internal) -> look up from all bindings
Hmm, I would find it more natural to have a separate macro, like
(:: MOD-NAME VAR-NAME)
where '::' would be the (to me) obvious choice of name.
Unfortunately, with (read-set! keyword 'prefix) that name would be a
keyword...
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-16 17:31 ` Marius Vollmer
@ 2003-11-16 18:20 ` Neil Jerram
2003-11-16 18:38 ` Neil Jerram
2003-11-16 20:28 ` Marius Vollmer
0 siblings, 2 replies; 19+ messages in thread
From: Neil Jerram @ 2003-11-16 18:20 UTC (permalink / raw)
Cc: guile-devel
>>>>> "Marius" == Marius Vollmer <mvo@zagadka.de> writes:
Marius> Hmm, I would find it more natural to have a separate macro, like
Marius> (:: MOD-NAME VAR-NAME)
Marius> where '::' would be the (to me) obvious choice of name.
Marius> Unfortunately, with (read-set! keyword 'prefix) that name would be a
Marius> keyword...
OK, fine, and in this case we don't strongly need to solve this
problem yet ...
Neil
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-16 18:20 ` Neil Jerram
@ 2003-11-16 18:38 ` Neil Jerram
2003-11-16 20:36 ` Marius Vollmer
2003-11-16 20:28 ` Marius Vollmer
1 sibling, 1 reply; 19+ messages in thread
From: Neil Jerram @ 2003-11-16 18:38 UTC (permalink / raw)
Cc: guile-devel
>>>>> "Marius" == Marius Vollmer <mvo@zagadka.de> writes:
Marius> Hmm, I would find it more natural to have a separate macro, like
Marius> (:: MOD-NAME VAR-NAME)
Marius> where '::' would be the (to me) obvious choice of name.
Marius> Unfortunately, with (read-set! keyword 'prefix) that name would be a
Marius> keyword...
Sorry that my thoughts on this are coming out in such a trickle!
I just noticed, though, that there are some other symbols (than :)
available that don't have other meanings and which could be understood
as relevant to a module lookup:
(@ MOD-NAME VAR-NAME)
Seems quite good, with @ meaning `at' as in `in the specified module'.
($ MOD-NAME VAR-NAME)
Tenuous link to $'s use in many languages for variable reference.
Clashes with not-yet-widespread use of $ for value-history, though.
(. MOD-NAME VAR-NAME)
Intuitively very similar to : IMO, but without the keyword issues.
However, (i) some people might want `.' for the mathematical dot
(scalar) product; (ii) Guile currently seems confused about whether
`.' is a symbol:
guile> .
ERROR: Unbound variable: .
ABORT: (unbound-variable)
guile> '.
.
guile> (define . 1)
ERROR: In procedure memoization:
ERROR: In line 3: Bad expression (define . 1).
ABORT: (syntax-error)
(? MOD-NAME VAR-NAME)
Quite nice, ? meaning a query, so a lookup.
Of these, I like @ the most.
Neil
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-16 18:20 ` Neil Jerram
2003-11-16 18:38 ` Neil Jerram
@ 2003-11-16 20:28 ` Marius Vollmer
1 sibling, 0 replies; 19+ messages in thread
From: Marius Vollmer @ 2003-11-16 20:28 UTC (permalink / raw)
Cc: guile-devel
Neil Jerram <neil@ossau.uklinux.net> writes:
>>>>>> "Marius" == Marius Vollmer <mvo@zagadka.de> writes:
>
> Marius> Hmm, I would find it more natural to have a separate macro, like
>
> Marius> (:: MOD-NAME VAR-NAME)
>
> Marius> where '::' would be the (to me) obvious choice of name.
> Marius> Unfortunately, with (read-set! keyword 'prefix) that name would be a
> Marius> keyword...
>
> OK, fine, and in this case we don't strongly need to solve this
> problem yet ...
It's only my personal taste, tho.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-16 18:38 ` Neil Jerram
@ 2003-11-16 20:36 ` Marius Vollmer
2003-11-17 20:18 ` Neil Jerram
0 siblings, 1 reply; 19+ messages in thread
From: Marius Vollmer @ 2003-11-16 20:36 UTC (permalink / raw)
Cc: guile-devel
Neil Jerram <neil@ossau.uklinux.net> writes:
> I just noticed, though, that there are some other symbols (than :)
> available that don't have other meanings and which could be understood
> as relevant to a module lookup:
Yes, for some reason, I was fixated on ':' and didn't seriously think
about alternatives.
> (@ MOD-NAME VAR-NAME)
> Seems quite good, with @ meaning `at' as in `in the specified module'.
Yes, I like this one best, too. We could use '@' for exported
bindings and '@@' for internal ones.
> (. MOD-NAME VAR-NAME)
> Intuitively very similar to : IMO, but without the keyword issues.
> However, (i) some people might want `.' for the mathematical dot
> (scalar) product; (ii) Guile currently seems confused about whether
> `.' is a symbol:
The dot '.' is a syntactic element when writing and reading improper
lists:
guile> (cons 'a 'b)
(a . b)
It can't really be used as a symbol.
> Of these, I like @ the most.
Yep.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-15 15:10 ` Marius Vollmer
@ 2003-11-17 2:00 ` Mikael Djurfeldt
2003-11-17 14:41 ` Marius Vollmer
0 siblings, 1 reply; 19+ messages in thread
From: Mikael Djurfeldt @ 2003-11-17 2:00 UTC (permalink / raw)
Cc: djurfeldt, guile-devel
Marius Vollmer <mvo@zagadka.de> writes:
> Mikael Djurfeldt <mdj@mit.edu> writes:
>
>> Marius Vollmer <mvo@zagadka.de> writes:
>>
>>> what about making the changes below? The only unclean thing is that
>>> we would need to change the interpretation of a single ':'.
>>
>> But isn't that pretty darn unclean? It changes the lexical structure
>> of the language.
>
> Hmm, yes and no. With the change, ':' remains a variable identifier
> and the new syntax is actually a macro:
OK, I see. For some reason I thought this would be done on the reader
level (maybe because of the discussion we've had about the syntax to
use for foreign identifiers in macro output (in the memoizer)).
>> I vote for using some syntax which is compatible with R5RS and would
>> urge you strongly to at least keep the possibility to be compatible
>> (=> new option controlling the interpretation of colon).
>
> Given that the syntax is compatible, do you think we still need an
> option for making (keyword ':) true again?
Unfortunately, I don't have time now to think that through. I guess
it does feel a bit awkward that we remove the read syntax for empty
keywords is removed this way, but I think I shouldn't meddle further
in this issue. :)
Best regards,
Mikael
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-17 2:00 ` Mikael Djurfeldt
@ 2003-11-17 14:41 ` Marius Vollmer
0 siblings, 0 replies; 19+ messages in thread
From: Marius Vollmer @ 2003-11-17 14:41 UTC (permalink / raw)
Cc: guile-devel
Mikael Djurfeldt <djurfeldt@nada.kth.se> writes:
>> Given that the syntax is compatible, do you think we still need an
>> option for making (keyword ':) true again?
>
> Unfortunately, I don't have time now to think that through. I guess
> it does feel a bit awkward that we remove the read syntax for empty
> keywords is removed this way, [...]
Yep, I agree, and I have changed it now to '@' at the suggestion of
Neil. I wanted to use ':' _so_ much, but I don't know why. I was
possessed...
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* New syntax (@ MODULE-NAME VARIABLE-NAME) committed
2003-11-13 18:12 New syntax: (: MODULE-NAME VARIABLE-NAME) Marius Vollmer
` (2 preceding siblings ...)
2003-11-16 8:02 ` Dirk Herrmann
@ 2003-11-17 14:44 ` Marius Vollmer
3 siblings, 0 replies; 19+ messages in thread
From: Marius Vollmer @ 2003-11-17 14:44 UTC (permalink / raw)
I have committed the following changes. (The unclean bit about
changing the interpretation of ':' is gone.)
** 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))
* Changes to Scheme functions and syntax
** New syntax '@' and '@@':
You can now directly refer to variables exported from a module by
writing
(@ MODULE-NAME VARIABLE-NAME)
For example (@ (ice-9 pretty-print) pretty-print) will directly access
the pretty-print variable exported from the (ice-9 pretty-print)
module. You don't need to 'use' that module first. You can also use
'@' with 'set!'.
The related syntax (@@ MODULE-NAME VARIABLE-NAME) works just like '@',
but it can also access variables that have not been exported. It is
intended only for kluges and temporary fixes and for debugging, not
for ordinary code.
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-16 20:36 ` Marius Vollmer
@ 2003-11-17 20:18 ` Neil Jerram
2003-11-17 21:34 ` Marius Vollmer
0 siblings, 1 reply; 19+ messages in thread
From: Neil Jerram @ 2003-11-17 20:18 UTC (permalink / raw)
Cc: guile-devel
>>>>> "Marius" == Marius Vollmer <mvo@zagadka.de> writes:
Marius> Yes, I like this one best, too. We could use '@' for exported
Marius> bindings and '@@' for internal ones.
Great!
>> (. MOD-NAME VAR-NAME)
>> Intuitively very similar to : IMO, but without the keyword issues.
>> However, (i) some people might want `.' for the mathematical dot
>> (scalar) product; (ii) Guile currently seems confused about whether
>> `.' is a symbol:
Marius> The dot '.' is a syntactic element when writing and reading improper
Marius> lists:
Ahem. I think I'd better just go and hide under a stone .... :-)
Neil
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: New syntax: (: MODULE-NAME VARIABLE-NAME)
2003-11-17 20:18 ` Neil Jerram
@ 2003-11-17 21:34 ` Marius Vollmer
0 siblings, 0 replies; 19+ messages in thread
From: Marius Vollmer @ 2003-11-17 21:34 UTC (permalink / raw)
Cc: guile-devel
Neil Jerram <neil@ossau.uklinux.net> writes:
> Marius> The dot '.' is a syntactic element when writing and
> Marius> reading improper lists:
>
> Ahem. I think I'd better just go and hide under a stone .... :-)
Hehe, but please do come back soon!
--
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3 331E FAF8 226A D5D4 E405
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2003-11-17 21:34 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-13 18:12 New syntax: (: MODULE-NAME VARIABLE-NAME) Marius Vollmer
2003-11-13 19:47 ` Neil Jerram
2003-11-13 20:58 ` Marius Vollmer
2003-11-14 21:04 ` Neil Jerram
2003-11-15 15:19 ` Marius Vollmer
2003-11-15 19:22 ` Neil Jerram
2003-11-16 17:31 ` Marius Vollmer
2003-11-16 18:20 ` Neil Jerram
2003-11-16 18:38 ` Neil Jerram
2003-11-16 20:36 ` Marius Vollmer
2003-11-17 20:18 ` Neil Jerram
2003-11-17 21:34 ` Marius Vollmer
2003-11-16 20:28 ` Marius Vollmer
2003-11-14 22:09 ` Mikael Djurfeldt
2003-11-15 15:10 ` Marius Vollmer
2003-11-17 2:00 ` Mikael Djurfeldt
2003-11-17 14:41 ` Marius Vollmer
2003-11-16 8:02 ` Dirk Herrmann
2003-11-17 14:44 ` New syntax (@ MODULE-NAME VARIABLE-NAME) committed Marius Vollmer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).