net.sf.staccatocommons.defs.Thunk Maven / Gradle / Ivy
/**
* Copyright (c) 2010-2012, The StaccatoCommons Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*/
package net.sf.staccatocommons.defs;
/**
* A {@link Thunk} is a computation that takes no arguments a returns a value.
* In other words, is an object that is capable of providing another one,
* through it {@link #value()} method.
*
*
* {@link Thunk}s of return type {@link Void} have semantics compatible with
* {@link Runnable}, as they do not provide a value, but a side effect instead
*
*
*
* Notice: the meaning of the term "Thunk" is sometimes vague and varies
* depending the context and author. Within Staccato-Commons, thunk
* must be interpreted a "no arguments expression"
*
*
* @author flbulgarelli
*
* @param
* the type of provided value
*
* @see Applicative Recomendations for implementing
*/
@Applicative
public interface Thunk {
/**
* Returns the value provided. Sending this message to the {@link Thunk} is
* also known as evaluating the thunk.
*
* @return the provided object. It is sometimes referred as the
* thunk's element
*/
T value();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy