[m-rev.] for review: warn about unneeded initial and final state vars
Zoltan Somogyi
zoltan.somogyi at runbox.com
Thu May 22 20:01:30 AEST 2025
On Thu, 22 May 2025 14:19:25 +1000, Peter Wang <novalazy at gmail.com> wrote:
> On Thu, 22 May 2025 12:21:48 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> > Refine unused final statevar warnings.
> > + UnderscoreSeparatedPieces = [_ | _],
> > + list.det_last(UnderscoreSeparatedPieces, LastPiece),
> > + string.to_int(LastPiece, _N),
> > + % This is either the initial or a middle version of SVarName.
> > + % (Initial if _N is zero, and middle otherwise)
> > + NumericalSuffix = "_" ++ LastPiece,
> > + SVarName = string.det_remove_suffix(AfterStdPrefix, NumericalSuffix)
> > + ).
>
> You could use string.find_last_char and string.unsafe_between.
The code is executed so rarely there is no point in optimizing it, so
I would prefer to avoid unsafe code.
I followed all your other suggestions. Thanks for the review.
> I have tested the patch, and it appears to work well. Thanks.
You are welcome.
Zoltan.
More information about the reviews
mailing list