chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] need idea for read-syntax


From: Category 5
Subject: Re: [Chicken-users] need idea for read-syntax
Date: Sun, 16 Nov 2003 08:34:35 +0000
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (berkeley-unix)

felix <address@hidden> writes:

> Statements inside #[ ... ]# always returns (void). The expansion will
> be something like this:
>
> (foreign-code " ... ")
>
> which in turn expands into (for the curious):
>
> (begin
>   (declare (foreign-declare
>              "static C_word <TMP>() { ... ; 
>                                       return C_SCHEME_UNDEFINED; }"))
>   (##core#inline "<TMP>") )      ; generate an inline call
>
> The typed expression expands into:
>
> (foreign-code " ... " <TYPE>)
>
> which ends up as:
>
> (begin
>   (define-foreign-variable <TMP> <TYPE> " ... ")
>   <TMP>)
>
> The difference between #[ ... ]# and #> ... <# is that the latter
> expands into a declaration at the start of the generated code and the
> former is put into a static function.  Program context doesn't really
> exist, since everywhere #> ... <# may be used is also a suitable
> context for #[ ... ]# (but one expands into a declaration part and the
> other into a code sequence to be run at the current position, even
> (and especially) if it appears at toplevel), since in Scheme there is
> no "declaration" section.

Gotcha  - this makes sense.  I like this idea!

-- 





reply via email to

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