This is the mail archive of the mailing list for the Guile project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Translation for extension is a bad idea

Han-Wen Nienhuys <> writes:

> * there is consensus that Scheme is scary due to prefix notation. This
>   suggest that there should be some infix dialect of Scheme.

I think this is misunderstandable.  The arithmetic of Scheme is
prefix, due to the fact that mathematical operators are functions
like everything else.  That function calls are "prefix" is normal
with most widely used languages nowadays (except where you can
define your own infix functions, e.g. in SML or Haskell), or if
the language is stack-oriented like Forth.

For example, in C++, you *can* also use operator+(1,1) (i'm not
so sure about the syntax).

What you say is that it's inconvient for users to use prefix
syntax for mathematical expressions.  The only thing required is
a special form which handles infix syntax, or maybe even just a
function like Tcl's expr.

That is, either something like
(define a 3)
[syntax] (expr (1+1) * a)
         -> (* (+ 1 1) a)
         => 6
[function] (expr "(1+1)*a")
           => 6

Actually, the first is just a matter of

(define-syntax expr
  (syntax-rules ()
    ((_ expressions ...)
        (lambda ()
	  (write '(expressions ...)))))))

If you have expr* as the function which evaluates a string.

expr* has to be able to get the value of variables.

It would of course be nicer if this would just be syntax that
rewrites the expression, but that's not easy (considering that
parsing (expr 1+1) in define-syntax isn't trivial...)

The point of the multiple language reader idea in guile is that
the program author just writes his program's interface to the
Scheme world, and the user decides which syntax to chose for
scripting the program at hand.

This means that the author maybe offers his own language for his
program, but which translates to scheme, so the user can use
Scheme (or actually, any other language which guile supports) as
well if the author's language isn't powerful enough for him.

Thus, it's not really necessary for Guile to *completely* grok
the language which it wants to read, but "mostly" is enough, it
should just be that the user can use his knowledge of his FPL to
script the application.
        -- forcer

((email . "")       (www . "")
 (irc   . "forcer@#StarWars (IRCnet)") (gpg . "/other/forcer.gpg"))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]