chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] redefinitions


From: Felix Winkelmann
Subject: Re: [Chicken-users] redefinitions
Date: Fri, 23 Jul 2004 08:43:25 +0200
User-agent: Opera M2/7.52 (Win32, build 3834)

On Fri, 23 Jul 2004 08:19:30 +0200, Michele Simionato <address@hidden> wrote:

Chicken made a lot of progress in these four years and I am
sure more will follow in the near feature :)

Hopefully, it will - if people keep helping, of course!

One option is to make globals available only in the module
where they are defined, i.e. not exported unless explicitely
declared. But this means a module system and use some
import mechanism different from "load", so let me not
pursue that.

Right, One could use the psyntax module system, or, if you
use compiled code, the `export' declaration.


A (apparently) simpler solution would be to warn the user
if a name is redefined. I mean

(define TAB-WIDTH 4)
(define TAB-WIDTH 8) ; error

should raise a redefinition error (that would be my preferred
behavior) or at least print a redefinition warning (if raising
the error would be too radical). The right way to
redefine things should be via set! :

(define TAB-WIDTH 4)
(set! TAB-WIDTH 8) ; ok

[...]

So I want to know if there is some hope to get this
"fixed", at least having a warning when things are
redefined in the same lexical scoping using define
instead of set! (of course shadowing a name with internal
defines or let is fine and should not raise any warning).

What do you think?

I think this is a reasonable thing to do. Currently `define'
is just a macro that expands into `set!', so it might need
some internal machinery to handle this properly. You are
talking about both interpreted and compiled code, right?


cheers,
felix




reply via email to

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