AssemblyScript / website

AssemblyScript's website and documentation.
https://www.assemblyscript.org
59 stars 88 forks source link

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

Open MaxGraey opened 2 years ago

MaxGraey commented 2 years ago

@dcodeIO could you take a look please?

dcodeIO commented 2 years ago

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

MaxGraey commented 2 years ago

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

MaxGraey commented 1 year ago

Can we merge it?

dcodeIO commented 1 year ago

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?

MaxGraey commented 1 year ago

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

dcodeIO commented 1 year ago

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.

MaxGraey commented 1 year ago

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