gregoryyoung / nothing

Replacement of the System.Void type
The Unlicense
57 stars 11 forks source link

Implement Zero type inhabited by no instances. #12

Open eulerfx opened 9 years ago

eulerfx commented 9 years ago

Maybe something like:

    public class Zero
    {
        private Zero() { }

        public static T For<T>()
        {
            throw new Exception();
        }
    }
gregoryyoung commented 9 years ago

Pull requests are welcome. However if you do this a Seq would also be useful.

On Fri, Mar 6, 2015 at 11:38 PM, Lev Gorodinski notifications@github.com wrote:

Maybe something like:

public class Zero
{
    private Zero() { }

    public static T For<T>()
    {
        throw new Exception();
    }
}

— Reply to this email directly or view it on GitHub https://github.com/gregoryyoung/nothing/issues/12.

Studying for the Turing test

dsyme commented 9 years ago

This type also supports the null value, see #2 . Please solve the programming language problem mentioned in that bug before adding further designs