Giter Site home page Giter Site logo

Comments (1)

333fred avatar 333fred commented on July 18, 2024 1

So, I'm thinking this is not bug (or at least, not an implementation bug. It may be a specification bug.) The constructor resolution section of the interpolated string handler specification says this (emphasis added):

  • Otherwise, the type of every resolved px is added to the argument list, in the order specified by the Arguments array. Each px is passed with the same ref semantics as is specified in M1.

Where px is the parameter of the resolved constructor, and M1 is the method being called (Append_Instance or Append_Extension in this case). The ref semantics of the receiver of an instance method isn't well-specified as far as I can tell; however, I'm somewhat unconvinced it should be allowed to be treated as ref implicitly, given that we may or may not emit dups for some structs. Should this code compile if the builder was a readonly parameter, for example? To make forward progress on this, I think a full rules change for C# would need to be proposed, specifying when a receiver would be allowed to be passed by ref to the constructor of an interpolated string handler; those rules could then be verified and reviewed, and we would have a full spec to test the implementation against. That would need to be opened on csharplang, and I would likely be willing to champion such a feature, but the proposal would need to come from someone else.

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.