website icon indicating copy to clipboard operation
website copied to clipboard

Add i8.parse, f32.parse ... bool.parse to docs

Open MaxGraey opened this issue 1 year ago • 8 comments

MaxGraey avatar Aug 26 '22 14:08 MaxGraey

@dcodeIO could you take a look please?

MaxGraey avatar Aug 27 '22 04:08 MaxGraey

I would probably wait documenting these as long as there is nothing noteworthy these can do in addition, like hex float notation?

dcodeIO avatar Aug 27 '22 05:08 dcodeIO

Ok, what is the best place e to put this into doc?

MaxGraey avatar Aug 27 '22 07:08 MaxGraey

Can we merge it?

MaxGraey avatar Jan 20 '23 15:01 MaxGraey

Discussion in Discord got me thinking about this again. Do I remember correctly that initially there was the thought of instead providing parseInt<T = f64>(str: string): T, and that you had preferred that originally?

dcodeIO avatar Jan 20 '23 16:01 dcodeIO

Here description & motivation: https://github.com/AssemblyScript/assemblyscript/pull/2465

MaxGraey avatar Jan 20 '23 16:01 MaxGraey

Thanks, now I remember the context. Do you know what were the reasons for not considering to make parseInt and parseFloat generic instead? Seems that we ultimately ended up aliasing anyway.

dcodeIO avatar Jan 20 '23 16:01 dcodeIO

Generic parseInt and parseFloat don't seem to solve this problem, because most likely we have to do something like parseInt<T = f64>(...) and parseFloat<T = f64>(...). Otherwise users will already have two compiled errors for these methods without explicitly specifying parameters. And I still suggest making the parseInt and parseFloat methods as deprecated

MaxGraey avatar Jan 20 '23 16:01 MaxGraey