[plt-scheme] Preventing built-in functions to be redefined

From: Noel Welsh (noelwelsh at gmail.com)
Date: Thu Jun 4 11:48:17 EDT 2009

I don't remember if there is a parameter to change this behaviour. One
way to get the effect you want is to require the language your module
is written. Try this and you'll get an error about redefinition

#lang scheme

(require scheme)
(define define 5)

In the years I've been writing Scheme this has never caused a problem for me.

N.

On Thu, Jun 4, 2009 at 3:24 PM, chaguidiao <chaguidiao at gmail.com> wrote:
> Hi
>
> I am fairly new in Scheme.  May I know if it is possible to restrict
> the redefinition of the built-in function, or if possible, make any
> other user-defined functions non-writable?  Pardon me for being a
> little paranoid, but the fact that (define define 5) actually making
> "define" equals to 5 is just somewhat alarming to me.
>
> Thanks.
> nandehutu


Posted on the users mailing list.