[plt-scheme] verifying whether a symbol is defined at compile time?

From: Yin-So Chen (yinso.chen at gmail.com)
Date: Mon Apr 23 01:14:39 EDT 2007

Hi all -

Just want to thank everyone (Jos, Matthew, Jens, and Eli) for providing the
pointers - this is awesome help.  I will study the different methods and
will definitely report back on my take aways ;)

Very appreciated. Thanks,
yinso

On 4/22/07, Eli Barzilay <eli at barzilay.org> wrote:
>
> On Apr 22, Matthew Flatt wrote:
> > At Sun, 22 Apr 2007 03:32:36 -0700, "Yin-So Chen" wrote:
> > > My motivation for having a conditional define is to make it play
> > > nice with the module system, which doesn't work well when having
> > > multiple definitions with the same name.  I was hoping there is an
> > > "automated" way of detecting whether a symbol is already defined
> > > in the current module, if so, either override or not import the
> > > definition.
> >
> > Within a module, `identifier-binding' should do the trick.
>
> Funny that this came right after the Swindle question -- they're
> related.  When you use `defmethod' Swindle is trying to guess whether
> you're defining a new method, or adding to an existing one.  See the
> code in "collects/swindle/clos.ss" (look for `identifier-binding') for
> how it's done -- my guess is that you'll want something similar.
>
> BUT -- having gone through that, I can tell you that you will need a
> lot of fighting to get things right.  It's a question whether it's
> worth it.  (In other words -- I often think that I should have not
> included a `defmethod' -- it's much cleaner to have only `defgeneric'
> and `add-method'.)
>
> --
>           ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
>                   http://www.barzilay.org/                 Maze is Life!
>



-- 
http://www.yinsochen.com
...continuous learning...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20070422/b79a4284/attachment.html>

Posted on the users mailing list.