Whenever we see a constant in a curryable-function such as the plus above, an actor<value<T> > (where T is the type of the constant) is, by default, automatically created for us. For instance, the example plus above is actually equivalent to:
plus(arg1, actor<value<int> >(value<int>(6)))
A nifty shortcut is the val(v) utility function. The expression above is also equivalent to:
actor<value<int> >(value<int>(6)) is implicitly created behind the scenes, so there's really no need to explicitly type everything but:
There are situations though, as we'll see later on, where we might want to explicily write val(x).
Like arguments, values are also actors. As such, values can be evaluated through the actor's operator(). Such invocation gives the value's identity. Example:
cout << val(3)() << val("Hello World")(); prints out "3 Hello World".
Copyright © 2001-2002 Joel de Guzman
Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.