[Swift-devel] Re: How to wait on functions that return no data?

Ben Clifford benc at hawaga.org.uk
Tue Mar 25 17:49:07 CDT 2008


On Tue, 25 Mar 2008, Michael Wilde wrote:

> Related to this virtual idea, is it possible to add language semantics where a
> function defined as returning an object can decide to return "null", in which
> case its deemed to be complete but decided no to generate a result?

Going to haskell way, introducing a Maybe type would be that - its a 
dataflow rather than control flow form of exception handling. You declare 
a type as 'maybe resultfile' and values of that type can be either 
'Nothing' or a result file.

You could have an array of:

(Maybe resultfile)[]

where each element is of type 'maybe resultfile' and so can (independent 
of the other elements) be a file or null.

-- 




More information about the Swift-devel mailing list