unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#10938: procedure-arguments return differnet output when procedure-property is used
@ 2012-03-04 12:15 Stefan Israelsson Tampe
  2012-03-04 12:23 ` bug#10938: patch Stefan Israelsson Tampe
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Israelsson Tampe @ 2012-03-04 12:15 UTC (permalink / raw)
  To: 10938

[-- Attachment #1: Type: text/plain, Size: 1188 bytes --]

Typeically in guile

> (procedure-arguments g)
$3 = ((required x) (optional) (keyword) (allow-other-keys? . #f) (rest .
#f))

for a program g. But if we attach a procedure property 'arglist the outpu
is acording to (system ice-9 session),
(define (procedure-arguments proc)
  "Return an alist describing the arguments that `proc' accepts, or `#f'
if the information cannot be obtained.

The alist keys that are currently defined are `required', `optional',
`keyword', and `rest'."
  (cond
   ((procedure-property proc 'arglist)
    => (lambda (arglist)
         `((required . ,(car arglist))
           (optional . ,(cadr arglist))
           (keyword . ,(caddr arglist))
           (allow-other-keys? . ,(cadddr arglist))
           (rest . ,(car (cddddr arglist))))))
   ((procedure-source proc)
    => cadr)
   (((@ (system vm program) program?) proc)
    ((@ (system vm program) program-arguments-alist) proc))
   (else #f)))

Acording to the description allow-other-keys? is not included, but returned
for a program
but not of prop 'arglist is used, so either

1. drop allow-other-keys? from the program? version or add it to the proper
version and change doc string

Regards
Stefan

[-- Attachment #2: Type: text/html, Size: 1354 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#10938: patch
  2012-03-04 12:15 bug#10938: procedure-arguments return differnet output when procedure-property is used Stefan Israelsson Tampe
@ 2012-03-04 12:23 ` Stefan Israelsson Tampe
  2012-03-05 16:59   ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Israelsson Tampe @ 2012-03-04 12:23 UTC (permalink / raw)
  To: 10938


[-- Attachment #1.1: Type: text/plain, Size: 120 bytes --]

Sorry I posted a version of session.scm with a prtly fix included
anyway here is a patch where we add allow-other-keys?

[-- Attachment #1.2: Type: text/html, Size: 131 bytes --]

[-- Attachment #2: session.diff --]
[-- Type: text/x-patch, Size: 743 bytes --]

diff --git a/module/ice-9/session.scm b/module/ice-9/session.scm
index fbb03d2..dc2c927 100644
--- a/module/ice-9/session.scm
+++ b/module/ice-9/session.scm
@@ -504,13 +504,14 @@ It is an image under the mapping EXTRACT."
 if the information cannot be obtained.
 
 The alist keys that are currently defined are `required', `optional',
-`keyword', and `rest'."
+`keyword', allow-other-keys? and `rest'."
   (cond
    ((procedure-property proc 'arglist)
     => (lambda (arglist)
          `((required . ,(car arglist))
            (optional . ,(cadr arglist))
            (keyword . ,(caddr arglist))
+           (allow-other-keys? . ,(cadddr arglist))
            (rest . ,(car (cddddr arglist))))))
    ((procedure-source proc)
     => cadr)

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#10938: patch
  2012-03-04 12:23 ` bug#10938: patch Stefan Israelsson Tampe
@ 2012-03-05 16:59   ` Ludovic Courtès
  2012-03-10 15:40     ` Stefan Israelsson Tampe
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2012-03-05 16:59 UTC (permalink / raw)
  To: Stefan Israelsson Tampe; +Cc: 10938

Hi Stefan,

Stefan Israelsson Tampe <stefan.itampe@gmail.com> skribis:

> diff --git a/module/ice-9/session.scm b/module/ice-9/session.scm
> index fbb03d2..dc2c927 100644
> --- a/module/ice-9/session.scm
> +++ b/module/ice-9/session.scm
> @@ -504,13 +504,14 @@ It is an image under the mapping EXTRACT."
>  if the information cannot be obtained.
>  
>  The alist keys that are currently defined are `required', `optional',
> -`keyword', and `rest'."
> +`keyword', allow-other-keys? and `rest'."
>    (cond
>     ((procedure-property proc 'arglist)
>      => (lambda (arglist)
>           `((required . ,(car arglist))
>             (optional . ,(cadr arglist))
>             (keyword . ,(caddr arglist))
> +           (allow-other-keys? . ,(cadddr arglist))
>             (rest . ,(car (cddddr arglist))))))
>     ((procedure-source proc)
>      => cadr)

Can you provide one or more test cases that illustrate that this patch
fixes?

Also, please send your patch in ‘git format-patch’ format.

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#10938: patch
  2012-03-05 16:59   ` Ludovic Courtès
@ 2012-03-10 15:40     ` Stefan Israelsson Tampe
  2012-07-02 13:11       ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Israelsson Tampe @ 2012-03-10 15:40 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 10938


[-- Attachment #1.1: Type: text/plain, Size: 1490 bytes --]

Following this email is the requested patch format

Test case.
With the patch:

(define (f x) x)
(define arg1 (procedure-arguments f))
(set-procedure-property! f 'arglist (map cdr arg1))
(define arg2 (procedure-arguments f))
(equal? arg1 arg2)
$4 = #t

Without the patch a field is missing and the result would be #f

/Stefan


2012/3/5 Ludovic Courtès <ludo@gnu.org>

> Hi Stefan,
>
> Stefan Israelsson Tampe <stefan.itampe@gmail.com> skribis:
>
> > diff --git a/module/ice-9/session.scm b/module/ice-9/session.scm
> > index fbb03d2..dc2c927 100644
> > --- a/module/ice-9/session.scm
> > +++ b/module/ice-9/session.scm
> > @@ -504,13 +504,14 @@ It is an image under the mapping EXTRACT."
> >  if the information cannot be obtained.
> >
> >  The alist keys that are currently defined are `required', `optional',
> > -`keyword', and `rest'."
> > +`keyword', allow-other-keys? and `rest'."
> >    (cond
> >     ((procedure-property proc 'arglist)
> >      => (lambda (arglist)
> >           `((required . ,(car arglist))
> >             (optional . ,(cadr arglist))
> >             (keyword . ,(caddr arglist))
> > +           (allow-other-keys? . ,(cadddr arglist))
> >             (rest . ,(car (cddddr arglist))))))
> >     ((procedure-source proc)
> >      => cadr)
>
> Can you provide one or more test cases that illustrate that this patch
> fixes?
>
> Also, please send your patch in ‘git format-patch’ format.
>
> Thanks,
> Ludo’.
>

[-- Attachment #1.2: Type: text/html, Size: 1973 bytes --]

[-- Attachment #2: session.patch --]
[-- Type: text/x-patch, Size: 1382 bytes --]

From 779289828e6e8340e4d1fb5097e9b9781588b4c1 Mon Sep 17 00:00:00 2001
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
Date: Sat, 10 Mar 2012 16:31:46 +0100
Subject: [PATCH] * module/ice-9/session.scm (procedure-arguments): missing
 field allow-other-keys? added

---
 module/ice-9/session.scm |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/module/ice-9/session.scm b/module/ice-9/session.scm
index fbb03d2..3e5ad3f 100644
--- a/module/ice-9/session.scm
+++ b/module/ice-9/session.scm
@@ -504,14 +504,15 @@ It is an image under the mapping EXTRACT."
 if the information cannot be obtained.
 
 The alist keys that are currently defined are `required', `optional',
-`keyword', and `rest'."
+`keyword',allow-other-keys?  and `rest'."
   (cond
    ((procedure-property proc 'arglist)
     => (lambda (arglist)
-         `((required . ,(car arglist))
-           (optional . ,(cadr arglist))
-           (keyword . ,(caddr arglist))
-           (rest . ,(car (cddddr arglist))))))
+         `((required          . ,(car arglist))
+           (optional          . ,(cadr arglist))
+           (keyword           . ,(caddr arglist))
+           (allow-other-keys? . ,(cadddr arglist))
+           (rest              . ,(car (cddddr arglist))))))
    ((procedure-source proc)
     => cadr)
    (((@ (system vm program) program?) proc)
-- 
1.7.9


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#10938: patch
  2012-03-10 15:40     ` Stefan Israelsson Tampe
@ 2012-07-02 13:11       ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2012-07-02 13:11 UTC (permalink / raw)
  To: Stefan Israelsson Tampe; +Cc: 10938-done

Hi Stefan,

Thanks, fixed differently in a8215aedad433a15abf87c2310a41c684dfcef97.

In the future, could you please provide a patch with a log and test case
similar to what’s in the above commit?

Ludo’.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-02 13:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-04 12:15 bug#10938: procedure-arguments return differnet output when procedure-property is used Stefan Israelsson Tampe
2012-03-04 12:23 ` bug#10938: patch Stefan Israelsson Tampe
2012-03-05 16:59   ` Ludovic Courtès
2012-03-10 15:40     ` Stefan Israelsson Tampe
2012-07-02 13:11       ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).