mkhan45 / RustScript2

RustScript is a functional scripting language with as much relation to Rust as Javascript has to Java.
https://mkhan45.github.io/RustScript2/
Other
36 stars 2 forks source link

Roadmap #6

Open mkhan45 opened 2 years ago

mkhan45 commented 2 years ago

To start out with, we want

Eventually it would be cool to have:

mkhan45 commented 2 years ago

named/optional arguments seem unnecessary since we can just use a map as an argument with pattern matching, but maybe there could be some syntax sugar

mkhan45 commented 2 years ago

We also need proper error messages, to start out we'd have to revamp the scanner so that we can pass line number and maybe column information to the parser

mkhan45 commented 2 years ago

records/named tuples might also be unneeded with maps

mkhan45 commented 2 years ago

I've considered it don't think we should have variadic lambdas anymore. They're significantly slower than just having multiple functions unless we implement it as syntax sugar, which has other problems. Since we have a match expression already it also seems a bit excessive and doesn't work well with the let name = fn(args) => expr syntax

WilliamRagstad commented 2 years ago

We also want the interactive REPL to not crash when an error occurs, but keep the previous state.

mkhan45 commented 2 years ago

I've made #22 for that

mkhan45 commented 2 years ago

currying might cause hard to debug errors, since error reporting is pretty minimal right now

mkhan45 commented 2 years ago

Inlining functions at preprocess time might be impossible since little is known about the functions called. However, it might be possible at runtime on a block by block basis

edit: alternatively, we could add an inline keyword

could also mark a function body as inlineable at definition time, and then actually in-line it at call time

mkhan45 commented 2 years ago

it might be possible to make a non tail recursive function tail recursive via ast transformation to use an accumulator in simple cases or by adding a stack accumulator in more complicated ones

edit: https://en.wikipedia.org/wiki/Continuation-passing_style