chicken-janitors
[Top][All Lists]
Advanced

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

Re: [Chicken-janitors] #1061: syntax-rules should be able to automatical


From: Chicken Trac
Subject: Re: [Chicken-janitors] #1061: syntax-rules should be able to automatically determine implicit exports (was: Implicit export of identifiers only works for syntax)
Date: Fri, 20 Nov 2015 13:19:49 -0000

#1061: syntax-rules should be able to automatically determine implicit exports
--------------------------------+---------------------
  Reporter:  syn                |      Owner:
      Type:  enhancement        |     Status:  new
  Priority:  not urgent at all  |  Milestone:  someday
 Component:  expander           |    Version:  4.8.x
Resolution:                     |   Keywords:
--------------------------------+---------------------
Changes (by sjamaan):

 * priority:  minor => not urgent at all
 * milestone:  4.11.0 => someday


Comment:

 I don't think this can be made to work in the general case.  The problem
 here is that if you construct an identifier name on the fly, it is
 possible to generate arbitrary procedure/variable names. That means
 potentially '''everything''' in a module should be considered "implicitly
 exported".

 I think it works for syntax because that runs fully interpreted inside the
 compiler, which means that (currently) nothing is optimized away, so all
 the definitions are kept around. It's more of a bug really that this works
 at all (and we may consider making it more strict to reduce confusion).

 That is a problem because it means none of the identifiers in a module
 would be eligible for inlining. Performance would suffer too much.

 This is the reason we have the special syntax for marking procedures as
 belonging to a macro. If you change it to the following, your example
 works:

 {{{
 #!scm
 ;;; foo.scm

 (module foo

 ((some-syntax some-implicitly-used-procedure))

 (import scheme)

 (define (some-implicitly-used-procedure x)
   (list x))


 (define-syntax some-syntax
   (syntax-rules ()
     ((_ x)
      (some-implicitly-used-procedure 'x))))

 )
 }}}

 I believe it '''may''' be possible to do this automatically for syntax-
 rules, but it would require an additional mechanism that one could also
 use with other macro expansion systems (like the {{{bindings}}} egg). In
 the end that would not be very different than doing this manually in the
 "indirect export" list, but it would be quite a bit of work.

 So it's more something for a wish-list rather than something we should fix
 ASAP.

--
Ticket URL: <http://bugs.call-cc.org/ticket/1061#comment:7>
CHICKEN Scheme <http://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

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