Avoid auto conversion of char[] to string in vb#79248
Avoid auto conversion of char[] to string in vb#79248CyrusNajmabadi wants to merge 2 commits intodotnet:mainfrom
Conversation
|
@RikkiGibson ptal. |
|
|
||
| Friend Function Intern(s As Char(), start As Integer, length As Integer) As String | ||
| Return _stringTable.Add(s, start, length) | ||
| Return _stringTable.Add(s.AsSpan(start, length)) |
There was a problem hiding this comment.
We will take #79245 for now to address the concern. Let's work out a solution for the broader set of lexer/TextWindow changes which doesn't require VB to use spans.
There was a problem hiding this comment.
I'm not really understanding the problem here with this. In what way are ref-structs not supported here? VB seems find creating the span and passing it along.
There was a problem hiding this comment.
we can still have the overloads that take the char[]+start+length. but i don't see how that is substantively better.
There was a problem hiding this comment.
In what way are ref-structs not supported here?
VB doesn't support consumption of ref structs. It is supposed to block any attempt to do this, and for many scenarios it does. However, several "holes" remain, that is not intentional though, and it doesn't make ref structs supported in VB.
There was a problem hiding this comment.
Good to know.
AlekseyTs
left a comment
There was a problem hiding this comment.
It looks like this change takes dependency on VB compiler bug that allows ref structs to be used in some scenarios. I am not comfortable doing this. An alternative approach would be to add special helpers to the shared layer (written in C#) for use from VB, the helpers can use ref structs in their implementation, but should neither take, nor return ref structs.
|
sure. i've added back in the helpers to allow vb to call this. |
|
Closing in favor of #79250 |
No description provided.