[plt-scheme] trying not to use eval

From: John Clements (clements at brinckerhoff.org)
Date: Tue Oct 29 10:44:57 EST 2002

On Tuesday, October 29, 2002, at 10:11  AM, Rohan Nicholls wrote:

>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>
>
> Noel Welsh wrote:
>> Common Lisp allows you to get the function associated
>> with a symbol with the symbol-function function.
>
> It was this functionality I was looking for in scheme....
>
>> There is no equivalent in R5RS Scheme that I'm aware
>> of.  However you can do it in PLT Scheme in a
>> restricted sense.  The question comes down to which
>> environment you want to resolve the symbol in.  If you
>> want to resolve the symbol in the current top-level
>> environment then you can use
>>   namespace-variable-value
>> To do the resolution in the lexical
>> environment...there's no way I know.
> the structure definition I want to get at is in the global space, so 
> that should work, but yes it would be nice to be able to do that on 
> the fly....

Er, ah... I'd like to point out that this solution is a poor one for 
exactly the same reasons that 'eval' is.

> Being an inordinately lazy programmer, I like to create generic 
> functions rather than have to type something twice.  This usually gets 
> me in trouble.:)

Can't you save the effort through abstraction, instead?


john



Posted on the users mailing list.