Giter Site home page Giter Site logo

Review code annotations about stride HOT 5 OPEN

Kryptos-FR avatar Kryptos-FR commented on June 14, 2024
Review code annotations

from stride.

Comments (5)

IXLLEGACYIXL avatar IXLLEGACYIXL commented on June 14, 2024 1

On DataContractAttribute
Stride: alias == System: name
System: namespace isnt implemented in stride but it could be
System: IsReference doesnt exist in stride
System: IsInherited doesnt exist in system
DefaultDataMemberMode is only used 3 times and can be removed in obsoletion path
so the datatypes would be there for datacontract.. being generous isreference and isinherited can somehow be interpreted the same way but if you use system datacontract you have to use DataMember of system as well, so you dont clash

in DataMember you have
DataMemberMode = required , cant be removed
order = exists on both
name = exists on both
mask = used for excluding members based on the mask ( dont know exactly ), may be dropped? dont know

with C#13 i think a new feature comes to extend existing classes with properties, this may also be available for annotations, so just extend the datamember attribute of system by mask and datamember mode and it could work

[NotNull] can be yoinked, inconsistenly used accross the engine and is replacable by nullable

from stride.

IXLLEGACYIXL avatar IXLLEGACYIXL commented on June 14, 2024 1

after thinking about it datastyle konstruktor is also required for properties so... only the scalarstyle konstruktor can be removed

from stride.

Eideren avatar Eideren commented on June 14, 2024

i think a new feature comes to extend existing classes with properties

If you're referring to extension types, this wouldn't help in our case:

Instance extension types cannot hold state. For example, they can’t include fields. They can access state on the underlying type or in another location.
https://devblogs.microsoft.com/dotnet/dotnet-build-2024-announcements/

Let's say that's fine, I wonder how safe it is to just adopt it like so, would feeding strides' types to microsoft's DataContractSerializer even work out of the box ? What about the other way around, random libraries that have some of their types annotated with microsoft's DataContract, how would those be serialized through our serialization system ?

Renaming that attribute should be fairly painless though, just have to mark the current one as obsolete and users can just mass replace DataContract with whatever name we thought of for the new one.

from stride.

IXLLEGACYIXL avatar IXLLEGACYIXL commented on June 14, 2024

goind towards incremental source generator inherited doesnt work anymore as each class needs the attribute as incremental source generators work on syntax not on semantic

we can still have the inherited bool to make a code fixer which is not relying on syntax that much as incremental source generator to automatically add the attribute which may be the better solution

sad that the new feature doesnt allow states :(

from stride.

IXLLEGACYIXL avatar IXLLEGACYIXL commented on June 14, 2024

DataStyle(ScalarStyle) constructor can be removed

the scalar style of a string in yaml can be automatically handled by the serializer depending on the context so this is somewhat overcomplicating the thing

if you have multi line string => literal
if you have spaces or special tokens/reserved words ( like !!null ) => go double quoted
if you have a char with a special token => go single quoted
if you have double line breaks => go for folded instead of literal.. which means folded and literal can be moved into 1 thing... even you can go so far to not support folded at all as literal is anyway doing the same

this way datastyle(DataStyle) is the only constructor that is needed => datastyle can be limited to classes only and properties can be removed, simplifies annotations by reducing its range of usage

by not auto handling this you receive bugs like with naming a scene #MainScene so the reference is written as 123545:#MainScene now its a comment , it should be written as "12345:#MainScene" so its also more error prone if the enduser has to handle it

the usage of the constructor in stride is afaic once... in a test...

from stride.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.