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

Add neo C# specification #1157

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Conversation

Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Aug 29, 2024

this is based on https://learn.microsoft.com/en-us/dotnet/csharp/specification/overview and adopted to neo C#, with all neo C# design details.

@Jim8y Jim8y marked this pull request as draft August 29, 2024 13:47
docs/1-scope.md Outdated
- The full C# language specification, as only a subset is used for Neo smart contracts;
- The mechanism by which C# smart contracts are compiled and deployed to the Neo blockchain;
- The mechanism by which C# smart contracts are invoked on the Neo blockchain;
- The mechanism by which input data are processed by a C# smart contract on Neo;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is processed

docs/1-scope.md Outdated
@@ -0,0 +1,18 @@
# 1 Scope

This specification describes the form and establishes the interpretation of programs written in a subset of the C# programming language used for Neo smart contracts. It describes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It describes:

docs/1-scope.md Outdated
- The semantic rules for interpreting Neo smart contract programs written in C#;
- The restrictions and limits imposed by the Neo blockchain for C# smart contracts.

This specification does not describe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:

docs/1-scope.md Outdated
- The mechanism by which input data are processed by a C# smart contract on Neo;
- The mechanism by which output data are processed after being produced by a C# smart contract on Neo;
- The size or complexity limitations of a smart contract imposed by the Neo blockchain;
- All minimal requirements of the Neo blockchain that is capable of supporting C# smart contracts.
Copy link
Member

@vncoelho vncoelho Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not understand this last sentence. Can you try to rephrase?

> int c = (int) b; // explicit conversion from long to int
> ```
>
> *end example*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is showing there.

Uploading image.png…

> Color c0 = 0;
>
> // Other int expressions need explicit conversion
> Color c1 = (Color)1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not understand this perfect, why just 0 automatically gets "Red" and 1 do not get "Blue"? Is that correct?

To get Blue we need (Color)1, yes?

> Func<int, int> square = x => x * x;
> ```
>
> *end example*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I think this end example in the end is wrong or a little bit strange.

@vncoelho
Copy link
Member

this is based on https://learn.microsoft.com/en-us/dotnet/csharp/specification/overview and adopted to neo C#, with all neo C# design details.

Very good @Jim8y, I will try to read it with time and comment. Very good initiative.

For the purposes of conversion, the types `object` and `dynamic` are identity convertible ([§10.2.2](10-conversions.md#1022-identity-conversion)).

However, dynamic conversions ([§10.2.10](10-conversions.md#10210-implicit-dynamic-conversions) and [§10.3.8](10-conversions.md#1038-explicit-dynamic-conversions)) apply only to expressions of type `dynamic` ([§8.2.4](8-types.md#824-the-dynamic-type)).

Copy link
Member

@vncoelho vncoelho Aug 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jim8y,

It would be good if you could mark the parts you actually write and the other ones from the original C# specification.
I imagined that, maybe, in this file, you wrote until here, and the remainder of this file would be be examples obtained from the original, without copy.

Can you clarify that?
I think that if you divide that (at least for now during revision), it will help a lot.

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

Successfully merging this pull request may close these issues.

2 participants