Repository navigation
[API Proposal]: Utf8Formatter/Utf8Parser should have UInt128 and Int128 overloads #73842
Description
Activity
- addedapi-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementation
on Aug 12, 2022 - ghost addeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Aug 12, 2022 - addedapi-ready-for-reviewAPI is ready for review, it is NOT ready for implementationAPI is ready for review, it is NOT ready for implementationand removedapi-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationuntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Aug 12, 2022 Looks good as proposed
namespace System.Buffers.Text; public static partial class Utf8Formatter { public static bool TryFormat(UInt128 value, System.Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { throw null; } public static bool TryFormat(Int128 value, System.Span<byte> destination, out int bytesWritten, System.Buffers.StandardFormat format = default(System.Buffers.StandardFormat)) { throw null; } } public static partial class Utf8Parser { public static bool TryParse(System.ReadOnlySpan<byte> source, out UInt128 value, out int bytesConsumed, char standardFormat = '\0') { throw null; } public static bool TryParse(System.ReadOnlySpan<byte> source, out Int128 value, out int bytesConsumed, char standardFormat = '\0') { throw null; } }
- addedapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedand removedapi-ready-for-reviewAPI is ready for review, it is NOT ready for implementationAPI is ready for review, it is NOT ready for implementation
on Sep 6, 2022 - ghost addedin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
on May 16, 2023 @krwq @tannergooding
I'm trying to implement this API, but there are a lot of usagesConvert.ChangeTypeandConvert.ToIntXXin the tests. Unfortunately, these methods are not support {U}Int128, is it by design or just nobody asked for this? Does this methods kind of obsolete and should be workarounded or I should create an issue with API proposal?For
Convert.ChangeTypeU{Int128} should implementIConvertible
ForConvert.ToIntXXjust add new methodsBtw, why U{Int128} returns a new instance every time in properties like
{Max/Min}ValueorNegativeOne? Other number types returns private consts or static readonly fields
public static Int128 MinValue => new Int128(0x8000_0000_0000_0000, 0); @dotnet/area-system-buffers (does this tags work? 🤔)
This is kind of blocking linked PR, need some help for comment above- ghost removedin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
on Jul 6, 2023 Much like with #53768 (comment), the plan is for APIs to simply implement
IUtf8SpanFormattableandIUtf8SpanParsablemoving forward.For number types in particular, parsing where the first invalid character is treated as "end of string" rather than "invalid input" will be supported via #87171
- addedapi-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationand removedapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implemented
on Jul 24, 2023 - ghost locked as resolved and limited conversation to collaborators
on Aug 24, 2023
Background and motivation
As I started looking into #73500 I realized Utf8Formatter/Utf8Parser are missing UInt128/Int128 overloads and therefore we need to unnecessarily do UTF16 <--> UTF8 conversion.
cc: @tannergooding
API Proposal
API Usage
Alternative Designs
No response
Risks
No response