Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split types up, add seq/bool/int, implement
if
This is mostly cleaning and a bit of adding features. For the most part: * Implement the `if` command, along with short-circuiting `and` and `or` commands. This doesn't cover actual expressions and comparisons and so on yet, I suspect that will go lisp-like instead of `expr`-like for ease of implementation, but haven't decided yet. * Implement `seq`, `int`, and `bool` types. The `int` type is a big.Int under the hood to ensure that all integers in a particular range can be represented. Literals that look like integers are automatically converted to integers as long as their text and integer-as-string representations are the same (otherwise, they remain strings to ensure that someone passing a flag like `+1` to a command doesn't result in the `+` being removed). And `int` command is provided for manual conversions. `bool` is straight-forward and just wraps Go's bool type. Literals are converted to booleans if their string value is `true` or `false` and otherwise are left alone. The `seq` type covers a range from one number to another with an arbitrary step. This is mainly intended for use with foreach since it doesn't require generating a whole list of numbers. You can expand it (`... [seq 100]`) to get a whole list of numbers, but it probably isn't that useful most of the time. * Move types into their own files, except for `Values` which belongs to type_value.go because it's the general purpose type for holding everything. This is just to get a bunch of stuff out of interp.go. * Remove `doInContext` and replace it with `Interp.Eval`. Similar behavior, less clunky. * Move the dump program to cmd/mtcldebug.
- Loading branch information