guile-user
[Top][All Lists]
Advanced

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

Re: How could this be implemented?


From: Jon Wilson
Subject: Re: How could this be implemented?
Date: Sun, 14 Jan 2007 19:37:30 -0600
User-agent: Thunderbird 1.5.0.9 (X11/20070103)

Hi Per,

Per Bothner wrote:
You really have to treat ls as a macro, which is resolved at
compile-time.  Otherwise, it becomes near-impossible to
compile name-lookup efficiently.  And if you can't compile
it, it's a toy.
Bash script is not compiled, but it is quite useful.  Not a toy at all.

> ... and it is bound to some value that we can see ...

This is the hard part: what does "that we can see" mean?
Perhaps I'm missing something, because this does not seem at all difficult. Suppose I am running some guile code. I type something like:

guile>(+ 2 5)

Eval looks up the + symbol and sees that it is bound to a primitive function. So, what "that we can see" means is anything which eval is already and normally able to resolve to some value. Perhaps the best way to implement this would be as an error handler for the Unbound variable error.

guile>(ls)

Backtrace:
In current input:
  2: 0* (ls)

<unnamed port>:2:1: In expression (ls):
<unnamed port>:2:1: Unbound variable: ls
ABORT: (unbound-variable)


Instead of dying when a variable in the function spot is not bound, we would do a quick $PATH lookup, and if we found something then, we'd execute it. Otherwise, we'd just go ahead with the Unbound variable error as normal.
Regards,
Jon




reply via email to

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