Re: [Chicken-hackers] functors

2011-03-24 Thread Felix
 One question: right now it is necessary to define an intermediary module
 and then another one to actually instantiate the functor like. in this
 example from the documentation:
 
   (module nums (multiply)
 (import scheme)
 (define (multiply x y) (* x y)))
 
   (module number-squarer = (squaring-functor nums))
 
 
 Maybe I didn't understand it all correctly but is there syntax for
 folding that into one definition? E.g. something like this:
 
 (module number-squarer ((instantiates: squaring-functor))
   (import scheme)
   (define (multiply x y) (* x y)))
 

squaring-functor takes any number of arguments, so your example
would probably an abbreviation for the common case of instantiating
a functor with a single argument module and providing the body of
that argument at the same step. Interesting! I'll ponder this.


cheers,
felix

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] functors

2011-03-24 Thread Thomas Chust
2011/3/24 Felix fe...@call-with-current-continuation.org:
 [...]
 (module foo (this that (interface: ARITHMETIC) the-other)
  ...)
 [...]

Hello,

just a small remark about the syntax: I find this use of keywords
rather unintuitive. I would either expect to be able to write
something like this:

  (module foo (bar baz #:interface ARITHMETIC boing) ...)

Or something like this:

  (module foo (bar baz (interface ARITHMETIC) boing) ...)

But a keyword in operator position is unusual and looks rather strange
to me.

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] functors

2011-03-24 Thread Felix
 Hello,

Hi!

 
 just a small remark about the syntax: I find this use of keywords
 rather unintuitive. I would either expect to be able to write
 something like this:
 
   (module foo (bar baz #:interface ARITHMETIC boing) ...)
 
 Or something like this:
 
   (module foo (bar baz (interface ARITHMETIC) boing) ...)
 
 But a keyword in operator position is unusual and looks rather strange
 to me.

The problem is that the latter example is ambiguous - it is the same
as exporting a macro interface that implicitly exports the binding
ARITHMETIC. The former example doesn't also looks confusing to me,
but that is more a matter of taste. The use of a keyword is indeed not
everybodies taste, but I couldn't come up with a better syntax that
is both unambiguous and obvious.


cheers,
felix

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-hackers


Re: [Chicken-hackers] functors

2011-03-24 Thread Felix
From: Moritz Heidkamp mor...@twoticketsplease.de
Subject: Re: [Chicken-hackers] functors
Date: Thu, 24 Mar 2011 12:12:50 +0100

 Maybe I didn't understand it all correctly but is there syntax for
 folding that into one definition? E.g. something like this:
 
 (module number-squarer ((instantiates: squaring-functor))
   (import scheme)
   (define (multiply x y) (* x y)))
 

One possible syntax would be:

(module number-squarer = squaring-functor
  (import scheme)
  ...)


cheers,
felix

___
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-hackers