guile-devel
[Top][All Lists]
Advanced

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

Re: User perception on backward compatibility


From: Neil Jerram
Subject: Re: User perception on backward compatibility
Date: Thu, 21 Jan 2010 20:14:40 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

address@hidden (Ludovic Courtès) writes:

> Hi,
>
> Thien-Thi Nguyen <address@hidden> writes:
>
>> At the moment, i would ask you to look at the guile-user message
>> w/ subject "(define ((f a) b) ...)".
>
> I didn’t reply on the grounds that Andy may have his views on this.  :-)

I think it just needs a bit of define-syntax.

As it happens, the definition of define-public has the required form:

(define-syntax define-public
  (syntax-rules ()
    ((_ (name . args) . body)
     (define-public name (lambda args . body)))
    ((_ name val)
     (begin
       (define name val)
       (export name)))))

and it works:

scheme@(guile-user)> (define-public ((f a) b) (* a b))
scheme@(guile-user)> (f 2)
#<program a117550 (b)>
scheme@(guile-user)> ((f 2) 3)
6

But I completely agree that we want `define' to support that too, `out
of the box'.

What is the correct way of writing something like this in boot-9.scm?

(define-syntax primitive-define define)

(define-syntax define
  (syntax-rules ()
    ((_ (name . args) . body)
     (define name (lambda args . body)))
    ((_ name val)
     (begin
       (primitive-define name val)
       (export name)))))

Regards,
      Neil




reply via email to

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