Giter Site home page Giter Site logo

Comments (4)

hamarb123 avatar hamarb123 commented on July 20, 2024

I have some code like this in some scenarios that require very low overhead to be useful:

interface IAction
{
    void Run(/*extra parameters here for some variants of it*/);
}

And I was hoping to update it to allow ref struct IActions so that I didn't have to do the pointer trick in these cases. (Note that I pass the generic TAction by reference to allow state changes to it when it runs)

I will post more use cases when I have a chance to go through more of the code where I ran into similar issues as I find or think of them.

from roslyn.

AlekseyTs avatar AlekseyTs commented on July 20, 2024

@hamarb123 Note, the plan is to keep ability for ref structs to implement interface behind a preview flag, the allows ref struct constraint on type parameters is not affected and will be fully supported.

from roslyn.

jaredpar avatar jaredpar commented on July 20, 2024

Related .NET issues

Related Customer Issues

from roslyn.

tannergooding avatar tannergooding commented on July 20, 2024

While ref structs implementing interfaces isn't something terribly important to me for .NET 9/C# 13, there is the slightly related feature of being able to mark interface members with [UnscopedRef] that is important and makes a difference in how the .NET Libraries team will ship ITensor<T>

We want to expose ROSpan<nint> Lengths { get; } which for structs (regular -or- ref struct) requires it be annotated as [UnscopedRef] so that you can return an InlineArray or equivalent to allow allocation free tracking of the multidimensional lengths buffer.

from roslyn.

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.