guile-user
[Top][All Lists]
Advanced

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

Re: Does declaration order matter in guile?


From: Dr. Arne Babenhauserheide
Subject: Re: Does declaration order matter in guile?
Date: Mon, 13 Feb 2023 11:44:23 +0100
User-agent: mu4e 1.8.13; emacs 28.1

Sascha Ziemann <ceving@gmail.com> writes:

> Am So., 12. Feb. 2023 um 20:52 Uhr schrieb Taylan Kammer
> <taylan.kammer@gmail.com>:
>>
>> On 12.02.2023 19:46, wolf wrote:
>>
>> > 1. When does order matter? What is going on here?
>>
>> The order matters in this case because the SRFI-9 implementation in Guile 
>> defines
>> syntax (macros) rather than just variables bound to procedures.
>
> This is a huge problem of Scheme in general, that you can not
> distinguish between
> procedures and macros just by looking at the code. You have to know it
> or you have
> to look it up in the manual.

I see this as a strength, because it allows me to start with a procedure
and switch it to be a macro later on if I need to.

That way I can start with the weaker but easier to reason about
construct and move to the stronger one when needed.

> You also can not ask Scheme about macros, because macros are not
> first-class-citizens.

Actually you can, though you need to take a detour through modules:

(define-syntax-rule (foo) #f)
(define (bar) #f)

(macro? (module-ref (current-module) 'foo))
;; => #t
(macro? (module-ref (current-module) 'bar))
;; => #f

(that’s from the info reference manual)

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de

Attachment: signature.asc
Description: PGP signature


reply via email to

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