chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] set! on unbound variable


From: Dan Leslie
Subject: Re: [Chicken-users] set! on unbound variable
Date: Sat, 24 Sep 2016 08:39:54 -0700
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

It seems that Chicken has a parameter to enforce R5RS strictness:

> -r5rs-syntax disables the Chicken extensions to R5RS syntax

So I gave it a shot with this issue:

> csi -r5rs-syntax
> CHICKEN
> (c) 2008-2014, The Chicken Team
> (c) 2000-2007, Felix L. Winkelmann
> Version 4.9.0.1 (stability/4.9.0) (rev 8b3189b)
> windows-mingw32-x86 [ manyargs dload ptables ]
> bootstrapped 2014-06-07
>
> Disabled the Chicken extensions to R5RS syntax
> #;1> (set! foo 1)
> #;2> foo
> 1

Well, damn. It is a bug.

-Dan

On 2016-09-23 6:45 PM, Kon Lovett wrote:

On Sep 23, 2016, at 6:31 PM, Dan Leslie <address@hidden> wrote:

Sounds like a Chicken Bug,

Chicken calls this a “convenience”. Yes, a std violation but handy using a REPL.

Should be able to defeat.

from the docs[‎0]:

<_expression_> is evaluated, and the resulting value is stored in the location to which <variable> is bound. <Variable> must be bound either in some region enclosing the set! _expression_ or at top level. The result of the set! _expression_ is unspecified.


-Dan

Sent from my BlackBerry 10 smartphone.
From: Jinsong Liang
Sent: Friday, September 23, 2016 6:27 PM
To: chicken chicken
Subject: [Chicken-users] set! on unbound variable

Hi,

I have been tripped by the following mistake a few times:

(let ((hello 0))
    (set! helo 1))

I meant to set! on hello. However, due to a typo, I did set! on helo. This bug is extremely hard to debug to me. Is there a way to make Chicken give warning on this? Or how do you handle this issue?

I know probably using set! is not a good programming style. I found that in some situations it is hard to avoid set!.

Thank you!

Jinsong
   

_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-users


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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