[plt-scheme] Re: Novice question: evaluating symbols

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Tue Jan 12 13:11:22 EST 2010

Mike G. wrote:
> On Fri, Jan 08, 2010 at 08:17:01AM -0600, Robby Findler wrote:
>> Turning symbols into identifiers at runtime is fundamentally an
>> eval-like thing and should be avoided in any well-designed language
>> (to get in my high horse for a moment).
>>
>> Computing with identifiers and thier names at compile time, on the
>> other hand, can also be confusing and lead to some funny issues, but
>> at least does not require invoking your compiler at runtime and all of
>> that baggage.
> 
> Maybe I've been thinking about symbols in the wrong way all
> along.  What's your distinction between symbols and identifiers?
>>From my background, they're more or less synonymous. 

"identifier" refers to a specific kind of data in PLT Scheme: a syntax 
object containing a symbol.

S-expressions are not a good representation for Scheme programs. They 
carry too little information to support all the things the macro 
expander and compiler want to do, like implement lexically scoped 
macros, report errors sensibly, and support analysis and transformation 
tools. Syntax objects are essentially S-expressions with room to put 
that kind of extra information.

> In my mind, symbols are implicitly dereferenced
> pointers-to-anything with a few extra features like
> string->symbol etc.  It seemed natural to me that, once x was
> (implicitly) dereferenced to the symbol date-year, date-year
> could be (explicitly) dereferenced to a procedure value.  eval
> was the obvious but heavy-handed way to do that.  Am I not
> "thinking in Scheme" here?

Your goal is to resolve a few (seven?) symbols to procedures. 'eval' is 
a large, complicated mechanism, and it requires some configuration 
before you can just use it. I'd rather just build a table.

A symbol only means something given a particular interpretation. For 
'eval', that interpretation is represented as a namespace object.

Ryan

> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.