unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Making the -e option compatible with new versions of Guile 1.4
@ 2005-01-14 16:33 Marius Vollmer
  2005-01-14 23:39 ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Vollmer @ 2005-01-14 16:33 UTC (permalink / raw)


Hi,

For 1.7, I have made Guile's interpretation of the -e option
compatible with the behavior of ttn's Guile 1.4 series.  When this
works out, I want to also install this in the 1.6 series.

What do you all think?

Here is the new documentation of -e:

`-e FUNCTION'
     Make FUNCTION the "entry point" of the script.  After loading the
     script file (with `-s') or evaluating the expression (with `-c'),
     apply FUNCTION to a list containing the program name and the
     command-line arguments -- the list provided by the `command-line'
     function.

     A `-e' switch can appear anywhere in the argument list, but Guile
     always invokes the FUNCTION as the _last_ action it performs.
     This is weird, but because of the way script invocation works under
     POSIX, the `-s' option must always come last in the list.

     The FUNCTION is most often a simple symbol that names a function
     that is defined in the script.  It can also be of the form `(@
     MODULE-NAME SYMBOL)' and in that case, the symbol is looked up in
     the module named MODULE-NAME.

     For compatibility with some versions of Guile 1.4, you can also
     use the form `(symbol ...)' (that is, a list of only symbols),
     which is equivalent to `(@ (symbol ...) main)', or `(symbol ...)
     symbol' (that is, a list of only symbols followed by a symbol),
     which is equivalent to `(@ (symbol ...) symbol)'.  We recommend to
     use the equivalent forms directly since they corresponf to the `(@
     ...)' read syntax that can be used in normal code, *Note Using
     Guile Modules::.

     *Note Scripting Examples::.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making the -e option compatible with new versions of Guile 1.4
  2005-01-14 16:33 Making the -e option compatible with new versions of Guile 1.4 Marius Vollmer
@ 2005-01-14 23:39 ` Neil Jerram
  2005-01-17 17:10   ` Marius Vollmer
  0 siblings, 1 reply; 6+ messages in thread
From: Neil Jerram @ 2005-01-14 23:39 UTC (permalink / raw)
  Cc: guile-user

Marius Vollmer wrote:
> Hi,
> 
> For 1.7, I have made Guile's interpretation of the -e option
> compatible with the behavior of ttn's Guile 1.4 series.  When this
> works out, I want to also install this in the 1.6 series.
> 
> What do you all think?

Looks good.  Also reminds me of an extension to @ or @@ that I was going 
to ask about.  Namely, so as to allow lookups within the environment of 
a closure.

So, for example, with

(define (xxx . args)
   (define (internal-proc x y z)
     ...)
   ...)

one could reference the procedure for "internal-proc" as

   (@@ (MODULE NAME) xxx internal-proc)

Probably only useful for debugging - i.e. it would make it possible to 
set a breakpoint on internal-proc - and other kinds of introspection, 
but what do you think?

(I also realize that what I've suggested doesn't really fit @/@@, 
because @/@@ currently return variables, and internal-proc in this case 
only exists as an ILOC.  But perhaps you can see a way round this?)

Regards,
	Neil


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making the -e option compatible with new versions of Guile 1.4
  2005-01-14 23:39 ` Neil Jerram
@ 2005-01-17 17:10   ` Marius Vollmer
  2005-01-17 19:32     ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Vollmer @ 2005-01-17 17:10 UTC (permalink / raw)
  Cc: guile-user

Neil Jerram <neil@ossau.uklinux.net> writes:

> [..] Also reminds me of an extension to @ or @@ that I was
> going to ask about.  Namely, so as to allow lookups within the
> environment of a closure.

Hmm, I don't think we should extend @ or @@ to do this.  Lexical
variables are different from global ones: they only exist within a
given environment and you need to specify that environment when
accessing them.  @ and @@ can not specify this environment.

> So, for example, with
>
> (define (xxx . args)
>    (define (internal-proc x y z)
>      ...)
>    ...)
>
> one could reference the procedure for "internal-proc" as
>
>    (@@ (MODULE NAME) xxx internal-proc)

Which procedure should this refer to?  Every call to xxx creates a new
procedure named 'internal-proc'.

> Probably only useful for debugging - i.e. it would make it possible to
> set a breakpoint on internal-proc - and other kinds of introspection,
> but what do you think?

Hmm, yes, in a debugger, your syntax could refer to all procedures
every created.  So it could be part of the syntax of the debugger, I
don't think it can be part of the syntax of normal Scheme programs.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making the -e option compatible with new versions of Guile 1.4
  2005-01-17 17:10   ` Marius Vollmer
@ 2005-01-17 19:32     ` Neil Jerram
  2005-01-17 19:43       ` Marius Vollmer
  0 siblings, 1 reply; 6+ messages in thread
From: Neil Jerram @ 2005-01-17 19:32 UTC (permalink / raw)
  Cc: guile-user

Marius Vollmer wrote:
> 
> Hmm, I don't think we should extend @ or @@ to do this.  Lexical
> variables are different from global ones: they only exist within a
> given environment and you need to specify that environment when
> accessing them.  @ and @@ can not specify this environment. [...]
 > Which procedure should this refer to?  Every call to xxx creates a new
> procedure named 'internal-proc'.

Ahem; yes, that's a pretty fundamental problem, isn't it.  I feel quite 
embarassed not to have realized this!

Thanks for pointing it out.

 > Hmm, yes, in a debugger, your syntax could refer to all procedures
 > every created.

Hmm - not sure what you mean here by "all procedures".

 >  So it could be part of the syntax of the debugger.

Yes - I'll give it some thought.  It's pretty clear what someone would 
mean by "setting a breakpoint on internal-proc", but we need to think of 
a way of saying this that works for more general local environment 
situations as well.

	Neil


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making the -e option compatible with new versions of Guile 1.4
  2005-01-17 19:32     ` Neil Jerram
@ 2005-01-17 19:43       ` Marius Vollmer
  2005-01-17 22:28         ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Marius Vollmer @ 2005-01-17 19:43 UTC (permalink / raw)
  Cc: guile-user

Neil Jerram <neil@ossau.uklinux.net> writes:

>  > Hmm, yes, in a debugger, your syntax could refer to all procedures
>  > ever created.
>
> Hmm - not sure what you mean here by "all procedures".

I meant, it could refer to the (define ...) form as a point in a
program.  Whenever that form is executed, the debugger might
instrument the created function so that the right thing happens (like
stopping on call when it is a breakpoint).


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Making the -e option compatible with new versions of Guile 1.4
  2005-01-17 19:43       ` Marius Vollmer
@ 2005-01-17 22:28         ` Neil Jerram
  0 siblings, 0 replies; 6+ messages in thread
From: Neil Jerram @ 2005-01-17 22:28 UTC (permalink / raw)
  Cc: guile-user

Marius Vollmer wrote:
> Neil Jerram <neil@ossau.uklinux.net> writes:
> 
> 
>> > Hmm, yes, in a debugger, your syntax could refer to all procedures
>> > ever created.
>>
>>Hmm - not sure what you mean here by "all procedures".
> 
> 
> I meant, it could refer to the (define ...) form as a point in a
> program.  Whenever that form is executed, the debugger might
> instrument the created function so that the right thing happens (like
> stopping on call when it is a breakpoint).
> 

Ah, I see.  That's the same as I meant by saying `it's pretty clear what 
someone would mean by "setting a breakpoint on internal-proc"' - I 
should have realized you meant the same thing :-)

	Neil



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-01-17 22:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-14 16:33 Making the -e option compatible with new versions of Guile 1.4 Marius Vollmer
2005-01-14 23:39 ` Neil Jerram
2005-01-17 17:10   ` Marius Vollmer
2005-01-17 19:32     ` Neil Jerram
2005-01-17 19:43       ` Marius Vollmer
2005-01-17 22:28         ` Neil Jerram

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).