Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2004-11-18 12:51:37


"Daniel Wallin" <dalwan01_at_[hidden]> wrote in message
news:cnidaq$tim$1_at_sea.gmane.org...
> David Abrahams wrote:
> > However, Thorsten's prodding has made me wonder if we need || for the
> > lazy case at all. It seems as though
> >
> > params.has(name) ? params[name] : something_else;
> >
> > is superior in every way except brevity. And there will be
> > substantial cases where it's briefer as well, because there's no need
> > to build a function object for something_else.
> >
> > Am I missing something?
>
> Yes, I think you are. We want params[name] to be a compilation error if
> there is no such parameter supplied by the user and no default. I don't
> think the proposed construct can allow that.
>
> IMO, a runtime error here is just not acceptable.

I disagree. I don't see compile-time error as an advantage here, but only a
burden. I very much prefer to be able to write

if( params.has(name) )
   f( params[name], ... )
else
  f( ... )

> --
> Daniel Wallin

Gennadiy.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk