[Top][All Lists]

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

Re: Re: Function call inside macros

From: Sergey Dolin
Subject: Re: Re: Function call inside macros
Date: Sun, 2 Sep 2001 11:54:31 +0600
User-agent: Mutt/1.2.5i

Alex Shinn (address@hidden) wrote:

Well. "We'll go another way"(c)V.I. Lenin
Can i bind symbols to values in "current environment"? I meen
something like scm_intern_symbol, but inside only "current let"?

 It seems nice to have 'magic' variables instead of
declaring them in 'let' and assign inside body afterward. There's
another case for this feture: getting data from database.

Now i have to write
 (let ((b1 (OCIBindByName stmt "field1"))
           (b2 (OCIBindByName stmt "field2"))
           (bn (OCIBindByName stmt "fieldn")))
           (OCIFetch stmt)
           (pk (oci8:ref b1))
           (pk (oci8:ref b2)))

It's ugly, It's big, It's not clear, It introduces entities (oci8:xxx)
not presented in Oracle Call Interface. Couldn't be better something
 (let (...)
   (OCIFetch ...)
   (pk field1)
   (pk field2)
 (pk field1);caused unbound variable error.

> To do what you want you're going to have to use an eval, because
It's sorrow. The power of macros is limited... I've supposed it, but
had a little hope.

> whatever you do inside the http:let could reference different
> variables which may or may not be defined, and will have to be
> compiled accordingly.
It's time to return to old disscussion about 'memoizing' macros,
isn't it?

> (define-macro (http:let binds . body)
>   `(eval (list (quote let)
>                (append (http:uri-query-string->lists
>                         (getenv "QUERY_STRING"))
>                        (list (quote ,@binds)))
>                (cons (quote begin) (quote (list ,@body))))
>          (current-module)))
> This will offer terrible performance.
Yes. I've experemented with this solution -- it's about ten times 
slower for almost empty body...

>What you're trying to do is
> also awkward in general,
I want to make guile PHP killer, and want to simulate all fetures of it.

>because you don't know for certain what
> variables are defined, and will have to wrap the whole thing in a
> catch
It's nessary in any case for cgi responses. User should get HTML page
with description error instead of "Internal Server Error".
  By the way: Is where way to substitute "standard" error handler?

>(apart from variable references, think what would happen if
> someone decided to rebind `let').
Then "someone" in its own.

> It's probably better to simply keep the query-string in an alist or
> hash and reference the values when you need them.
Ugly. Pascal'ish like thing(IMHO).

Mutt/1.2.5i*FVWM2*[FreeBSD 4.3-RELEASE]*(486DX2-50/20/730 Digial HiNote cs450)

reply via email to

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