Re: s48_extract_string?

Donald Allen <[email protected]>
Newsgroups gmane.lisp.scheme.scheme48
Message-ID <[email protected]>
On Tue, Mar 3, 2009 at 11:19 AM, Richard Kelsey <[email protected]> wrote:

>   Date: Tue, 3 Mar 2009 07:17:15 -0500
>   From: Donald Allen <[email protected]>
>
>   So in "Command Programs", commands, normally typed at the
>   REPL in ",command args" syntax are now in s-exp syntax
>   and s-expressions need to be wrapped in run in order to
>   be evaluated properly?
>
> "Command Programs" are just Scheme programs that have access
> to procedures that correspond to the commands.  The 'run' is
> needed to evaluate expressions in the current user
> environment.  If you just want to evaluate them in the exec
> package you don't need the 'run'.
>
>  > ,exec (let ((a '(2 3))) (apply + a))
>  5
>  >
>
> When your program
>
>  (open 'external-calls)
>  (open 'load-dynamic-externals)
>   (load-dynamic-externals ...)
>
> gets evaluated in the 'exec' package, 'open' is a procedure
> that, like the ,open command, opens a package in the current
> user package.  'load-dynamic-externals' is free in the
> 'exec' package, which is where the program is running.  It's
> bound in the user package, and
>  (run '(load-dynamic-externals ...))
> is one way to evaluate the expression in that package.
>
>   When there's REPL code that already distinguishes quite
>   nicely between commands and s-expressions?  Why wasn't
>   the latter used to read from a file, so that "command
>   programs" would have the same syntax as accepted by the
>   REPL, instead of introducing this grossly underdocumented
>   new command language?
>
> It isn't a new language at all, which is why there is no
> documentation for it.  The language is Scheme, with some
> additional functions added.  I believe that Scheme is
> adequately documented.  It may be that the additional
> functions in the exec package could use additional
> documentation, but that doesn't seem to be the problem
> you are running into.


A few comments:

1. I'm failing to understand why what works in the REPL doesn't work when
loading from a file.  In other words, why is

,open external-calls
,open load-dynamic-externals

acceptable when typing to the REPL and not acceptable when loading a file?

2. As for whether it's a new language, that depends on how you define
"language" (sounds Clintonesque :-). Sure, it's Scheme syntax, but in order
to say what I want to say in normal Scheme acceptable at the REPL, e.g.,

(load-dynamic-externals "/home/dca/Scheme48/postgresql.so" #f #f #f)
(import-lambda-definition pg_open_connection (dbname))

I now need to wrap in a call to 'run' when loading a file. To me that's new
language -- things need to be said differently.

3. "It may be that the additional
functions in the exec package could use additional
documentation, but that doesn't seem to be the problem
you are running into." Aside from objecting to the difference in
representation between typed and loaded from a file, this is *precisely*
what I'm running into. It was far from clear how to cast two simple commands
and two simple s-expressions so that they would be evaluated correctly when
loaded from a file. So, yes, I agree with you, the behavior of the exec
package does need additional documentation, especially since it behaves in a
way that I find counter-intuitive (differently than the REPL).

I do hope that the feedback I'm giving you is coming across in the spirit in
which it is intended. As I said in other messages, I'm an experienced Scheme
programmer, but a newcomer to Scheme48. I've heard great things about this
system and that there's been an emphasis on simplicity and clean design. So
where I think it falls short, I will say so, with constructive intent. You,
of course, are free to accept or reject my comments as you see fit. But I
just wanted to be sure you understand that I am not doing this for the sheer
joy of being critical, which doesn't interest me in the least.

/Don





>                                  -Richard Kelsey
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.