Qix- / arua-meta

Standards, RFCs and discussion of the Arua language
44 stars 2 forks source link

RFC: StdLib: std.math (Math library) #16

Open Qix- opened 8 years ago

Qix- commented 8 years ago

The std.math library is a standard library that provides functions and operators.

~TODO~

I want to provide standard implementations of FFT, operators that use mathematical symbols, etc. For instance,

use std.math.ops.*

a i32 = 4
b f32 = √a

Any ideas on this would be nice. Fleshing out the standard library isn't something I want to mess with yet as I have a strong opinion about separating the language from the libraries.

corbin-r commented 8 years ago

I think you should have FFT implementations joined with #18 this could be quite powerful.. Being able to use math functions just by using a symbol.

However there is something to be wary about, the more symbols that are jammed into the language, the more the compiler has to work to link those symbols to the proper function (taking up compile time), there most likely is a way to go about this as said in #18 with "writing arua in arua" so there would be a 1:1 ratio of the language being compiled. So I would have dedicated symbols for the more simple math functions (beside the normal +-/*). But reserved more complicated math functions to actual function names.

Qix- commented 8 years ago

@Polygn yep exactly. As well, the additional symbols have to be imported to work; they're not globals.

FFT would be super powerful, though I'm worried about specific implementations being less ideal than others, etc. MatLab users don't seem to have a problem with any of that though. Just a thought on FFT specifically.

corbin-r commented 8 years ago

@Qix- True. MatLab does have an efficient way of having custom symbols for complex math operations. Well... If you write the language to be like Swift, in the sense that it supports unicode (which wouldn't be hard) you could easily parse the unicode characters and have Arua understand that those are reserved math symbols/functions, you're golden.

EDIT Just realized you referenced unicode support here: #11