ponyc icon indicating copy to clipboard operation
ponyc copied to clipboard

String find/rfind change (RFC #80)

Open SeanTAllen opened this issue 10 months ago • 8 comments
trafficstars

Change the return type of String.find and String.rfind from ISize to USize, aligning its return type with Array.find.

See RFC #80 for details.

SeanTAllen avatar Jan 16 '25 16:01 SeanTAllen

@hovsater I want to get this in before the release at the end of the month. I am happy to do, but didn't want to "swipe it from you" if you were wanting to do. Let me know if you want to do it.

SeanTAllen avatar Jan 16 '25 16:01 SeanTAllen

Thanks for the ping, @SeanTAllen. I definitely want to do this. I'll open a draft PR shortly for the compiler itself. How do we address usage in Pony packages? I remember you said the same person should do that. Should I search for usage?

hovsater avatar Jan 16 '25 16:01 hovsater

We test them with each nightly for breakage, so after it's merged, within 36 hours, we'd know.

SeanTAllen avatar Jan 16 '25 17:01 SeanTAllen

@hovsater i want to get this in by Monday to have enough time to fix breakage before the release next weekend. Can you do that or should I get this?

SeanTAllen avatar Jan 25 '25 19:01 SeanTAllen

@hovsater i want to get this in by Monday to have enough time to fix breakage before the release next weekend. Can you do that or should I get this?

Sorry for the silence. I've been super busy with work and family, so I doubt I'll have a chance to address this before end of month.

Feel free to jump on it if this is urgent. I'd be happy to finish it, but likely that would be sometime in early February.

hovsater avatar Jan 26 '25 17:01 hovsater

I started to do this RFC and I am pausing. We need to discuss the RFC and if we want to go forward. It might not be extensive enough. Throughout string, we have things like:

fun ref cut_in_place(from: ISize, to: ISize = ISize.max_value())

Which doesn't make a ton of sense with the find and rfind change from ISize to USize for return type. We need to review all the offset related methods (some are USize and some are ISize) and make sure we want to make this change without doing others.

SeanTAllen avatar Jan 26 '25 19:01 SeanTAllen

We are going to move forward with the RFC.

SeanTAllen avatar Feb 04 '25 19:02 SeanTAllen

Whoever picks this up needs to be very careful. Make sure for everything in String that is changed by this change that there is test coverage to verify that the math being done on offsets doesn't get messed up by going from signed to unsigned.

SeanTAllen avatar Feb 07 '25 19:02 SeanTAllen