[Swift-devel] Re: How to wait on functions that return no data?
Mihael Hategan
hategan at mcs.anl.gov
Tue Mar 25 18:09:44 CDT 2008
On Tue, 2008-03-25 at 22:49 +0000, Ben Clifford wrote:
> 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.
pretty much like try {a[x] = f(x)} catch {} or maybe(a[x] = f(x)).
>
More information about the Swift-devel
mailing list