Boost logo

Boost :

From: Brian McNamara (lorgon_at_[hidden])
Date: 2004-02-28 15:45:17

Thanks much for submitting a formal review and for your comments. You
clearly spent a bit of time reviewing the library and I appreciate it.

A few quick remarks to address a few of your questions...

On Sat, Feb 28, 2004 at 02:53:23PM -0500, Gennadiy Rozental wrote:
> I do not understand need for separate notion of thunks. Why couldn't we
> just bind all function arguments using usual means?

The "usual means" are either explicit currying or implicit currying.
Given a 3-arg f:

   f(x) or f(x,_,_) // result is binary func

just binds the first arg, and

   f(x,y) or f(x,y,_) // result is unary func

just binds the first two, but clearly we can't say

   f(x,y,z) // calls f

to bind all three, as this is the syntax to call the function now. As a
result, the separate

   thunk3(f,x,y,z) // result is nullary func

is used when you want to bind all N arguments and get back a nullary
functor (a thunk).

> Implementation
> -------------------------------------------------------------------------
> This does not look like a good solution. What exactly did you try to
> achieve?
> 2. definition.cpp
> What is this? Does it gets compiled by any compiler?

Joel de Guzman showed me an elegant solution which gets rid of the need
for either of these, so they will disappear.

> 5 What is konst vs. const?

I think section 10.7 of the docs explains what they do:

   const_ // Turns a value into a thunk
      // Ex: const_(3) yields a new function "f": f()=3
   konst // Turns a value into a constant unary function
      // Ex: konst(3) yields a new function "f": f(anything)=3

-Brian McNamara (lorgon_at_[hidden])

Boost list run by bdawes at, gregod at, cpdaniel at, john at