fasteval
fasteval copied to clipboard
Add REPL binary target
It would be great if you could provide a binary target which is a REPL to quickly perform calculations in the command line.
I would work on this issue if you accpet it
I already have a REPL in the 'examples' directory: https://github.com/likebike/fasteval/blob/master/examples/repl.rs
It can be run like this: rlwrap cargo run --release --example repl
Were you thinking of something different? I'd be happy to consider your ideas.
One constraint is that I don't want to add too many dependencies to 'fasteval'. But a REPL really needs a good 'readline' user interface. That's why I structured this to be wrapped with 'rlwrap'.
One possible solution would be to make another 'fasteval-repl' crate which uses the 'fasteval' library, but produces a repl binary. This way, dependencies like readline can be isolated from 'fasteval'.
Do you have other ideas?
That’s exactly what I thought of. I saw the example and created my own binary but it’s much easier if you provide a fasteval REPL crate.
If you want to create a REPL crate, that's fine with me. I personally don't want to create an official REPL right now because it would actually take a lot of work to create a really really good REPL. You see, fasteval
is actually a very capable library; The REPL that I provide as an example barely "scratches the surface" of fasteval
's abilities. If I made a REPL, I would want to include advanced functionality, like the ability to create user-defined functions at run-time, and I would probably want to implement additional number types besides f64 (I'd probably want BitInteger support, along with cryptography functions, and I'd probably want Rational numbers too. Oh! and definitely complex numbers!)...
In other words, creating a great REPL is really a lot of work. If we just create a very-simple REPL (like the example), then I don't think it's actually useful for anything -- it's not an interesting product. Python and bc are already better. That's why I feel it deserves an example, but not an official crate at this point.
I'll create an official REPL after we have Advanced Numeric Types:
- Complex Numbers
- Rational Numbers
- Arbitrary Precision Numbers
- Big Integers + Crypto
Update: I created #7 to track this goal.
Okay. Thanks for the information.
@likebike I'm sharing my fasteval-repl with my friends (cargo install
conveniency). I will take it down if you do mind or when you implemented Advanced Numeric Types
or when the official REPL is going to be published.
I will understand if you mind for the name and thank you @likebike for your great library :pray:
@Ujang360 I don't mind at all. Thanks for doing this!
In the future, once fasteval is more mature, I think we can make and even better REPL. But for now, this is a good solution.