chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] case vs. eq? - just curious ....


From: Peter Bex
Subject: Re: [Chicken-users] case vs. eq? - just curious ....
Date: Sat, 3 Mar 2012 19:31:50 +0100
User-agent: Mutt/1.4.2.3i

On Sat, Mar 03, 2012 at 11:14:34AM -0700, Matt Welland wrote:
> It sounds like the answer I was looking for is that there is no scheme
> "introspection" that maps a procedure to the bound name.

It was part of my point that there is no "the bound name", there
can be several.  What would this return?

(define x (lambda (y) (lambda () y)))
(name-of (x))

Or this:

(define (a b c) (apply b c))
(define gt >)
(a (list gt))

There can be many things that are aliases for the same procedure.

> Thanks for the detailed analysis. I probably should have been clearer, I
> was merely wondering if there was some slick introspection available in
> scheme that would make this general and easy.

Contrary to popular belief and other Lisps, Scheme is really quite a
"static" language and lacks many of the more dynamic introspection
facilities of languages and systems like CLOS, Ruby or (shudder!) PHP.

This is generally a good thing, as it allows for pretty efficient
compilation and these introspection things only allow people to paint
themselves into a corner. Introspection allows cutting through the
language's abstraction barriers (which are there for a reason!) which
makes it too easy to write code riddled with assumptions about how the
other person's code is supposed to work.  Of course this kind of code
breaks the minute the other code makes internal changes (think
monkey-patching).

But the disadvantage is of course that it also means you can't use the
power of these facilities when they are called for (see also the lack of
general SLIME integration for Scheme).

> Although for the reasons you pointed out I won't be using it I did get to
> learn something.

I'm glad to hear that I've provided some useful insights!

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth



reply via email to

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