Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] bigint alias #11993

Closed
asibahi opened this issue Jun 14, 2016 · 12 comments
Closed

[Proposal] bigint alias #11993

asibahi opened this issue Jun 14, 2016 · 12 comments

Comments

@asibahi
Copy link

asibahi commented Jun 14, 2016

In F#, there is a language-wide alias for System.Numerics.BigInteger, which is bigint.

Does this make sense to include in C# at a language level?

@Unknown6656
Copy link

@asibahi: I totally agree. I also would like to propose some kind of bigint literal, to tell the compiler that the given number is of type bigint, e.g.:

bigint i = 315420000000000000000B;

@asibahi
Copy link
Author

asibahi commented Jun 14, 2016

@Unknown6656 The bigint literal in F# is I, capital. As in:

let aBigInt = 1000I

F# doesn't have implicit casting from int to bigint, as it happens

@gordanr
Copy link

gordanr commented Jun 14, 2016

Very interesting proposal.

@aluanhaddad
Copy link

Shouldn't it be biginteger?:bike::house:

@BrettJacobitz
Copy link

Could cause confusion for sql server bigint which equates to Int64.

@Unknown6656
Copy link

Unknown6656 commented Jun 30, 2016

@aluanhaddad : Well if it were biginteger, one could directly write BigInteger and simply import System::Numerics.......
I personally think, that bigint is better, as it is shorter 😉

@BrettJacobitz : I (personally) do not think so....
I found it rather confusing the first time I worked with SQL, that bigint == Int64: I thought, that Int64 should be called long in SQL, and that SQL's bigint should be a datatype, which is 'bigger' than a 64Bit Integer number.

@aluanhaddad
Copy link

How about including complex

@gordanr
Copy link

gordanr commented Jul 1, 2016

I would like to see both bigint and complex in c#. Very nice.
Complex numbers have two parts. What would the complex literal be like?

var z = (2.3, 5.7); // existing syntax, tuple or complex?

Could it be possible?
complex z = 2.3 + 5.7i;
complex z = 2.3 + i5.7;

What is the literal if we use only one part?
complex z = 2.3;
complex z = 5.7i;
complex z = i5.7;

@svick
Copy link
Contributor

svick commented Jul 1, 2016

@gordanr It's almost possible already.

Assuming this simple type:

static class ComplexConstants
{
    public static readonly Complex i = Complex.ImaginaryOne;
}

And this static using:

using static ComplexConstants;

You can write:

Complex z = 2.3 + 5.7*i;
Complex z = 5.7*i;

@gordanr
Copy link

gordanr commented Jul 1, 2016

@svick, This is really cool piece of code. Look obvious, but I didn't know that trick. Thank you very much.

I am not sure if 2.3 + 5.7*i is compile time constant.

It is personal opinion, but I think that notation without '*' could be more appropriate.
complex z = 2.3 + 5.7i;

@aluanhaddad
Copy link

@gordanr that's a good point, it won't be a compile time constant but I don't think there's any way of avoiding that.
@svick very elegant. No new syntax, and the multiplication symbol is intuitive and correct.

@gafter
Copy link
Member

gafter commented Aug 10, 2017

Issue moved to dotnet/csharplang #805 via ZenHub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants