Re: [Chicken-users] importing a syntactic binding for level -1

2019-07-13 Thread Peter Bex
On Sat, Jul 13, 2019 at 02:12:48PM +0200, Marco Maggi wrote:
> Peter Bex wrote:
> 
> > This won't work.  "rename" is operating in the syntactic environment
> > of the transformer.  You can pass it as a procedure to some other module,
> > but that won't change its internal state.
> 
> So, is RENAME closed upon  the environment in which ER-MACRO-TRANSFORMER
> is called?  So I can do something like:

Yes, that's how it should work.

>   I'm  not  trying   to  inject  syntactic  bindings   in  the  original
> environment, I just want to put as much as possible of a macro body into
> a separate library to be imported "for syntax".

Personally, I find that confusing, because the module containing the
macro definition determines the available identifiers.  If you then move
the actual expansion code to another module, that doesn't give a clue as
to which identifiers are available in the expansion.

So for stylistic reasons I'd avoid that.  You can still move processing
code to another module, but I would pass the renamed identifiers to the
helper procedure, instead of the "rename" procedure itself.

Cheers,
Peter


signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] importing a syntactic binding for level -1

2019-07-13 Thread Marco Maggi
Peter Bex wrote:

> This won't work.  "rename" is operating in the syntactic environment
> of the transformer.  You can pass it as a procedure to some other module,
> but that won't change its internal state.

So, is RENAME closed upon  the environment in which ER-MACRO-TRANSFORMER
is called?  So I can do something like:

(module (for-expand)
(the-transformer)
  (import (scheme)
  (chicken syntax))
  (define (the-transformer input-form.stx rename compare)
(define %fx+ (rename 'fx+))
---)
  #| end of module |#)

(module (for-runtime)
()
  (import (scheme)
  (chicken syntax)
  (chicken fixnum))
  (import-for-syntax (scheme)
 (for-expand))
  (define-syntax the-macro
(er-macro-transformer the-transformer))
  #| end of module |#)

and  RENAME  will  cleanly  pick  FX+  from  the  environment  in  which
ER-MACRO-TRANSFORMER has been called?

  I'm  not  trying   to  inject  syntactic  bindings   in  the  original
environment, I just want to put as much as possible of a macro body into
a separate library to be imported "for syntax".
-- 
Marco Maggi

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Build issue: is there a shortcut?

2019-07-13 Thread felix . winkelmann
> Hi all,
> 
> while cross compiling I wonder: this builds (in my case) a lot of
> binaries which have a path compiled in into the development
> environment.  These are essentially useless.  They just take my time to
> compile and waste space on the SSD.
> 
> Probably there is a target for `make` to use instead of the default,
> which would just build the (static) library and *.import.scm files I
> need on the host system.  Just which one I haven't been able to figure
> out.  Which one is it?
> 

"make libs" could work, but I haven't tried it. The import libraries
should be produced as a side effect from building the libraries, IIUC.


felix


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] [announce] MMCK Infix

2019-07-13 Thread Marco Maggi
An infix to prefix notation transformer:


-- 
Marco Maggi

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] importing a syntactic binding for level -1

2019-07-13 Thread Peter Bex
On Sat, Jul 13, 2019 at 08:26:56AM +0200, Marco Maggi wrote:
>   I would like to write such macro as:
> 
> (import (scheme)
> (chicken fixnum))
> (import-for-syntax (scheme)
>(only (chicken syntax)
>  er-macro-transformer)
>(only (my-lib)
>  doit))
> 
> (define-syntax spiffy
>   (er-macro-transformer
> (lambda (input-form.stx rename compare)
>   (define %fx+ (doit rename))
>   ---)))
> 
> and in the library "(my-lib)" I have:
> 
> (define (doit rename)
>   (rename 'fx+))
> 
> but for  this to work  cleanly: in "(my-lib)"  I should import  "fx+" at
> level -1?  Is it right?

Hi Marco,

This won't work.  "rename" is operating in the syntactic environment
of the transformer.  You can pass it as a procedure to some other module,
but that won't change its internal state.

>   This is possible with R6RS implementations.  How about CHICKEN?

That is very surprising to me.  It should not be possible.  You're
probably comparing apples and oranges (syntax-case works differently
from ER macros).

Cheers,
Peter


signature.asc
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] importing a syntactic binding for level -1

2019-07-13 Thread Marco Maggi
Ciao,

  it is my understanding that, if I write a macro as follows:

(import (scheme)
(chicken fixnum))
(import-for-syntax (scheme)
   (only (chicken syntax)
 er-macro-transformer))

(define-syntax spiffy
  (er-macro-transformer
(lambda (input-form.stx rename compare)
  (define %fx+ (rename 'fx+))
  ---)))

the function RENAME will pick  "fx+" from the runtime environment (which
is level 0).

  I would like to write such macro as:

(import (scheme)
(chicken fixnum))
(import-for-syntax (scheme)
   (only (chicken syntax)
 er-macro-transformer)
   (only (my-lib)
 doit))

(define-syntax spiffy
  (er-macro-transformer
(lambda (input-form.stx rename compare)
  (define %fx+ (doit rename))
  ---)))

and in the library "(my-lib)" I have:

(define (doit rename)
  (rename 'fx+))

but for  this to work  cleanly: in "(my-lib)"  I should import  "fx+" at
level -1?  Is it right?

  This is possible with R6RS implementations.  How about CHICKEN?

TIA
-- 
Marco Maggi

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users