Re: [Chicken-users] set! on unbound variable
Particularly since Chicken is in the minority of Schemes that allow this behaviour. I'm not a fan of fast-and-loose binding and typing, personally; it's a source of too many mistakes. -Dan On 2016-09-24 5:14 PM, Derrell Piper wrote: > I agree that it's allowed but it would an optional warning would be > very nice. > > > > ___ > Chicken-users mailing list > Chicken-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/chicken-users signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] set! on unbound variable
I agree that it's allowed but it would an optional warning would be very nice. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] set! on unbound variable
On Sat, Sep 24, 2016 at 11:39 AM, Dan Lesliewrote: > It seems that Chicken has a parameter to enforce R5RS strictness: > > > -r5rs-syntax disables the Chicken extensions to R5RS syntax > All that does is disable the syntax keywords that are normally available but are not part of R5RS, so it's not relevant here. In any case, R5RS does allow the approach Chicken takes to unknown variables. Section 5.2.1. says: Some implementations of Scheme use an initial environment in which all possible variables are bound to locations, most of which contain undefined values. Top level definitions in such an implementation are truly equivalent to assignments. See http://trac.sacrideo.us/wg/wiki/SetUndefinedVariable for which Schemes do this and which do not. -- John Cowan http://vrici.lojban.org/~cowanco...@ccil.org After fixing the Y2K bug in an application: WELCOME TO DATE: MONDAK, JANUARK 1, 1900 ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] set! on unbound variable
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 <d...@ironoxide.ca >> <mailto:d...@ironoxide.ca>> 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]: >> >> > is evaluated, and the resulting value is stored in the >> location to which is bound. must be bound >> either in some region enclosing the set! expression or at top level. >> The result of the set! expression is unspecified. >> >> 0: https://wiki.call-cc.org/man/4/The%20R5RS%20standard#assignments >> >> -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 >> Chicken-users@nongnu.org <mailto:Chicken-users@nongnu.org> >> https://lists.nongnu.org/mailman/listinfo/chicken-users > signature.asc Description: OpenPGP digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] set! on unbound variable
Then I think this seriously deserves a warning, because the code is not only against the standard, but potentially a bug, as shown in my case. Thank you everyone for your help! Jinsong On Fri, Sep 23, 2016 at 9:47 PM, Evan Hansonwrote: > Hi Jinsong, > > Not a bug, but certainly something that can be confusing if you don't > expect it. In your example, `helo` is implicitly defined as a toplevel > variable at the point of `set!. > > The difference is noted (very, very succinctly) in the manual here: > > http://wiki.call-cc.org/man/4/Extensions%20to%20the%20standard#set > > Unfortunately there's not currently a way to generate a warning in this > situation, that I know of. > > Cheers, > > Evan > ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] set! on unbound variable
Hi Jinsong, Not a bug, but certainly something that can be confusing if you don't expect it. In your example, `helo` is implicitly defined as a toplevel variable at the point of `set!. The difference is noted (very, very succinctly) in the manual here: http://wiki.call-cc.org/man/4/Extensions%20to%20the%20standard#set Unfortunately there's not currently a way to generate a warning in this situation, that I know of. Cheers, Evan ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] set! on unbound variable
> On Sep 23, 2016, at 6:31 PM, Dan Leslie <d...@ironoxide.ca> 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]: > > > is evaluated, and the resulting value is stored in the > > location to which is bound. must be bound either in > > some region enclosing the set! expression or at top level. The result of > > the set! expression is unspecified. > > 0: https://wiki.call-cc.org/man/4/The%20R5RS%20standard#assignments > > -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 > Chicken-users@nongnu.org > https://lists.nongnu.org/mailman/listinfo/chicken-users ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] set! on unbound variable
Sounds like a Chicken Bug, from the docs[0]:> <_expression_> is evaluated, and the resulting value is stored in the location to which is bound. must be bound either in some region enclosing the set! _expression_ or at top level. The result of the set! _expression_ is unspecified.0: https://wiki.call-cc.org/man/4/The%20R5RS%20standard#assignments -Dan Sent from my BlackBerry 10 smartphone.From: Jinsong LiangSent: Friday, September 23, 2016 6:27 PMTo: chicken chickenSubject: [Chicken-users] set! on unbound variableHi,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 Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[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 Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users