Re: [Chicken-hackers] read/write invariance of #!

2019-01-20 Thread Peter Bex
On Mon, Jan 14, 2019 at 09:16:18AM +1300, Evan Hanson wrote:
> No worries, here's an updated version of the patch that should apply
> nicely to HEAD.

I've pushed this, thanks guys!  I've also added a little regression test
for this.

Cheers,
Peter


signature.asc
Description: PGP signature
___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] read/write invariance of #!

2019-01-13 Thread Jim Ursetto
> On Jan 13, 2019, at 2:16 PM, Evan Hanson  wrote:
> 
> 
> I don't think this change fixes the example you gave as a "certain
> strange combination" in ticket #1572, i.e. (#! (foo bar)). ISTM that
> happens because any whitespace after a "#!" token causes the reader to
> skip everything until the end of the line (and the same goes for a
> forward slash); see the first clause at library.scm:4242:

That’s ok. With the change, #! will be written out as |#!|, which will be read 
back in as a symbol. The problem was #! being written out unquoted.

Jim
___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] read/write invariance of #!

2019-01-13 Thread Evan Hanson
On 2019-01-13 22:28, felix.winkelm...@bevuta.com wrote:
> > Does anyone know what that's about? I can't figure out what feature that
> > code is there to support. It's been there since the first check-in to
> > Git (I didn't look any further back than that).
> 
> That's intentional, to handle shebang lines as comments.

Oh, of course! Thanks Felix.

Evan

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] read/write invariance of #!

2019-01-13 Thread felix . winkelmann
> I don't think this change fixes the example you gave as a "certain
> strange combination" in ticket #1572, i.e. (#! (foo bar)). ISTM that
> happens because any whitespace after a "#!" token causes the reader to
> skip everything until the end of the line (and the same goes for a
> forward slash); see the first clause at library.scm:4242:
> 
> (cond ((and (char? c)
> (or (char-whitespace? c) (char=? #\/ c)))
>(skip-to-eol)
>(readrec) )
>   (else
>(let ([tok (r-token)])
>  (cond [(string=? "eof" tok) #!eof]
> 
> Does anyone know what that's about? I can't figure out what feature that
> code is there to support. It's been there since the first check-in to
> Git (I didn't look any further back than that).

That's intentional, to handle shebang lines as comments.


felix


___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] read/write invariance of #!

2019-01-13 Thread Evan Hanson
Hi Jim,

On 2019-01-12 10:04, Jim Ursetto wrote:
> 
> > On Jan 11, 2019, at 9:47 PM, Jim Ursetto  wrote:
> > 
> >> On Jan 11, 2019, at 3:12 PM, Evan Hanson  >> > wrote:
> >> 
> >> In case someone decides to apply this patch, there's an unnecessary (and 
> >> ...)
> >> around the conditional that can be removed.
> > 
> > Hi Evan,
> > Sorry for the delay. I happened to be testing this out earlier today—it 
> > appears to be fine, applied to HEAD from today. (With the and clause 
> > intact.)
> 
> Looks like I tested this with core from a few days ago, prior to #1077 being 
> applied, which touched the same code. Therefore the patch needs to be updated 
> slightly. Unfortunately it missed 5.0.1. :(

No worries, here's an updated version of the patch that should apply
nicely to HEAD.

I don't think this change fixes the example you gave as a "certain
strange combination" in ticket #1572, i.e. (#! (foo bar)). ISTM that
happens because any whitespace after a "#!" token causes the reader to
skip everything until the end of the line (and the same goes for a
forward slash); see the first clause at library.scm:4242:

(cond ((and (char? c)
(or (char-whitespace? c) (char=? #\/ c)))
   (skip-to-eol)
   (readrec) )
  (else
   (let ([tok (r-token)])
 (cond [(string=? "eof" tok) #!eof]

Does anyone know what that's about? I can't figure out what feature that
code is there to support. It's been there since the first check-in to
Git (I didn't look any further back than that).

Cheers,

Evan
>From e71e5daa4a94a126510ce9e939c8fa57f1bc2ef1 Mon Sep 17 00:00:00 2001
From: felix 
Date: Sun, 23 Dec 2018 20:44:51 +0100
Subject: [PATCH] Preserve read/write invariance for symbols prefixed with "#!"

Only #!rest, #!key and #!optional should be written, since they are the
only symbols of that type recognised by the reader.

Signed-off-by: Evan Hanson 
---
 library.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/library.scm b/library.scm
index 08c437df..6a089955 100644
--- a/library.scm
+++ b/library.scm
@@ -4501,8 +4501,7 @@ EOF
    (not (and (fx> len 2)
 		 (eq? (##core#inline "C_subchar" str 1) #\#)
 		 (not (eq? (##core#inline "C_subchar" str 2) #\#)
-  ;; #!rest, #!key etc
-  (eq? (##core#inline "C_subchar" str 1) #\!))
+  (member str '("#!rest" "#!key" "#!optional")))
  ((specialchar? c) #f)
  (else #t) ) )
 			 (let ((c (##core#inline "C_subchar" str i)))
-- 
2.11.0

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] read/write invariance of #!

2019-01-12 Thread Jim Ursetto

> On Jan 11, 2019, at 9:47 PM, Jim Ursetto  wrote:
> 
>> On Jan 11, 2019, at 3:12 PM, Evan Hanson > > wrote:
>> 
>> In case someone decides to apply this patch, there's an unnecessary (and ...)
>> around the conditional that can be removed.
> 
> Hi Evan,
> Sorry for the delay. I happened to be testing this out earlier today—it 
> appears to be fine, applied to HEAD from today. (With the and clause intact.)


Looks like I tested this with core from a few days ago, prior to #1077 being 
applied, which touched the same code. Therefore the patch needs to be updated 
slightly. Unfortunately it missed 5.0.1. :(

Jim___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] read/write invariance of #!

2019-01-11 Thread Jim Ursetto
> On Jan 11, 2019, at 3:12 PM, Evan Hanson  wrote:
> 
> On 2018-12-27 10:38, Jim Ursetto wrote:
>> Thanks Felix. This looks good but I haven’t had a chance to test it yet.
>> Will report back.
> 
> Any luck? This looks OK to me.
> 
> In case someone decides to apply this patch, there's an unnecessary (and ...)
> around the conditional that can be removed.

Hi Evan,
Sorry for the delay. I happened to be testing this out earlier today—it appears 
to be fine, applied to HEAD from today. (With the and clause intact.) I haven’t 
seen any issues with the chicken-doc index after application.

I would apply but I haven’t touched core in a long time, and I don’t want to 
bork the procedure, so a regular contributor should probably do it. But if 
someone is willing to walk me through it on IRC this weekend, I certainly don’t 
mind.

Jim

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] read/write invariance of #!

2019-01-11 Thread Evan Hanson
On 2018-12-27 10:38, Jim Ursetto wrote:
> Thanks Felix. This looks good but I haven’t had a chance to test it yet.
> Will report back.

Any luck? This looks OK to me.

In case someone decides to apply this patch, there's an unnecessary (and ...)
around the conditional that can be removed.

Evan

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] read/write invariance of #!

2018-12-27 Thread Jim Ursetto
Thanks Felix. This looks good but I haven’t had a chance to test it yet. Will 
report back.
Jim

> On Dec 23, 2018, at 1:46 PM, felix.winkelm...@bevuta.com wrote:
> 
> Hi!
> 
> Attached is a patch that seems to work for me. I don't think #!eof
> should be handled specially, as it is a distinct object.
> 
> 
> felix<0001-preserve-read-write-invariance-for-symbols-prefixed-.patch>


___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] read/write invariance of #!

2018-12-23 Thread felix . winkelmann
Hi!

Attached is a patch that seems to work for me. I don't think #!eof
should be handled specially, as it is a distinct object.


felixFrom 834a8d231d5bcdfc9bc517e8902ceee3c18d98e8 Mon Sep 17 00:00:00 2001
From: felix 
Date: Sun, 23 Dec 2018 20:44:51 +0100
Subject: [PATCH] preserve read/write invariance for symbols prefixed with "#!"
 only for #!rest, #!key and #!optional

---
 library.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/library.scm b/library.scm
index 0891f6a4..1e95382e 100644
--- a/library.scm
+++ b/library.scm
@@ -4556,8 +4556,8 @@ EOF
  (eq? c #\-) )
  (not (##sys#string->number str)) )
 ((eq? c #\:) (not (eq? ksp #:prefix)))
-((eq? c #\#) ;; #!rest, #!key etc
- (eq? (##core#inline "C_subchar" str 1) #\!))
+((and (eq? c #\#))
+  (member str '("#!rest" "#!key" 
"#!optional")))
 ((specialchar? c) #f)
 (else #t) ) )
 (let ((c (##core#inline "C_subchar" str i)))
-- 
2.16.2

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers