[Top][All Lists]

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

Re: [Chicken-users] some feedback on van Tonder's macros as implemented

From: felix winkelmann
Subject: Re: [Chicken-users] some feedback on van Tonder's macros as implemented in Chicken
Date: Mon, 22 Aug 2005 08:47:51 +0200

On 8/20/05, Michele Simionato <address@hidden> wrote:
> First of all, do you remember my long standing complaint that interpreter
> and compiler should work the same, i.e. the interpreter should not
> magically import modules that are not imported by the compiler? It seems
> that with simple-macros something similar happens: for instance, I have to
> explicitely import extras, even in interpreted code, whereas usually this
> is automagically imported by the interpreter. 

You have to differentiate between loading/linking and import. To be able
to link statically, I prefer separating the two steps.

> Also,the syntax
> (require-extension simple-macros)
> (require-extension (module extras))
> (import extras)
> is quite ugly. Maybe we would need a (require-module extras) to be
> interpreted as (require-extension (module extras)) (import extras)
> [in general (require-extension <name>) would load a file named
> <name>-module.scm or <name> and import from it a module
> called <name>].

Yes, that's a good idea. I already tried something like this, but due to silly
technical reasons it doesn't work yet. I'm sure I can provide a better
probably with the help of Andre.

> I also have a bug report. chicken-macros-module.scm has "assert" in the
> export list, but it is not defined, so I cannot use "assert".

Oops. Will be fixed.

> I cannot use Andrew Wright's 'match' package together with simple-macros.
> I understand there is 'matcher' module, however it is only of subset
> of Wright's module which I use all the time.

Wrights pattern matcher is written with low-level macros. It should be possible
to port it to simple-macros, though...

> Now, on purpose, I make syntax error in the definition of m*:
> (define m*
>   (match-lambda*
>    () 'no-argument-given)
>    ((x) 'one-argument-given))
> Syntax error:
> Syntax error in definition: (define m*#top (match-lambda*#top ()
> (quote no-argument-given#top)) ((x#top) (quote
> one-argument-given#top)))
> In source context:
>   (define m*#top (match-lambda*#top () (quote no-argument-given#top))
> ((x#top) (quote one-argument-given#top)))
> Error: (simple-macros.scm, line 1763) Expansion stopped
> This error message is absolutely terrible. I get an unreadable
> message (at least the source should be pretty-printed), I get it
> twice and the line number information has nothing to do with the
> origin of the problem. By contrast, Andrew Wright's match-lambda
> has a much saner output:
> (define m*
>   (match-lambda*
>    () 'no-argument-given)
>    ((x) 'one-argument-given))
> Error: during expansion of (define ...) - (define) too many arguments:
> ((match-lambda* () (quote no-argument-given)) ((x) (quote
> one-argument-given)))

That has nothing to do with the pattern matcher, it's an invalid definition.

> Apart from this example with the pattern matcher, in general simple-macros
> error messages would be better if they would provide properly formatted
> non-redundant code, possibly with '#top' stripped from the identifiers.
> It is also best to have no line number information rather than a misleading
> one.

 You are of course correct. There will be a major overhaul of the module
system once it is submitted as a SRFI, and I will try to improve the
error messages,
once we have a new, final version.

Thanks for your helpful comments.


reply via email to

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