go/README.md

This commit is contained in:
John Kerl 2020-09-06 21:37:10 -04:00
parent 125c894668
commit 261ff2735f
3 changed files with 25 additions and 8 deletions

View file

@ -2,16 +2,20 @@
* This is not necessarily a full Go port of Miller. At the moment, it's a little spot for some experimentation. Things are very rough and very iterative and very incomplete. I don't commit to finishing a Go port but I very much hope to.
* One reason Miller exists is to be a useful tool for myself and others; another is it's fun to write. At bare minimum, I'll re-teach myself some Go.
* In all likelihood, though, this will turn into a full port which will someday become Miller 6.0.
* In all likelihood, though, this will turn into a full port which will someday become Miller 6.0. As noted below, this will be a win both at the source-code level, and for users of Miller.
* I hope to retain backward compatibility at the command-line level as much as possible.
* Benefits of porting to Go:
* The lack of a streaming (record-by-record) JSON reader in the C implementation ([issue 99](https://github.com/johnkerl/miller/issues/99)) is immediately solved in the Go implementation.
* The quoted-DKVP feature from [issue 266](https://github.com/johnkerl/miller/issues/266) will be easily addressed.
* String/number-formatting issues in [issue 211](https://github.com/johnkerl/miller/issues/211), [issue 178](https://github.com/johnkerl/miller/issues/178), [issue 151](https://github.com/johnkerl/miller/issues/151), and [issue 259](https://github.com/johnkerl/miller/issues/259) will be fixed during the Go port.
* I think some DST/timezone issues such as [issue 359](https://github.com/johnkerl/miller/issues/359) will be easier to fix using the Go datetime library than using the C datetime library
* The code will be easier to read and, I hope, easier for others to contribute to.
* In the meantime I will still keep fixing bugs, doing some features, etc. in C on Miller 5.x -- in the near term, support for Miller's C implementation continues as before.
# Benefits of porting to Go
* The [lack of a streaming (record-by-record) JSON reader](http://johnkerl.org/miller/doc/file-formats.html#JSON_non-streaming) in the C implementation ([issue 99](https://github.com/johnkerl/miller/issues/99)) is immediately solved in the Go implementation.
* Previously [arrays were not supported in the DSL](http://johnkerl.org/miller/doc/file-formats.html#Arrays); now they will be.
* [Flattening nested map structures to output records](http://johnkerl.org/miller/doc/file-formats.html#Formatting_JSON_options) was clumsy. Now, Miller will be a full JSON-to-JSON processor, if your inputs and outputs are both JSON; JSON input and output will be idiomatic.
* The quoted-DKVP feature from [issue 266](https://github.com/johnkerl/miller/issues/266) will be easily addressed.
* String/number-formatting issues in [issue 211](https://github.com/johnkerl/miller/issues/211), [issue 178](https://github.com/johnkerl/miller/issues/178), [issue 151](https://github.com/johnkerl/miller/issues/151), and [issue 259](https://github.com/johnkerl/miller/issues/259) will be fixed during the Go port.
* I think some DST/timezone issues such as [issue 359](https://github.com/johnkerl/miller/issues/359) will be easier to fix using the Go datetime library than using the C datetime library
* The code will be easier to read and, I hope, easier for others to contribute to.
# Efficiency of the Go port
As I wrote [here](http://johnkerl.org/miller/doc/whyc.html) back in 2015 I couldn't get Rust or Go (or any other language I tried) to do some test-case processing as quickly as C, so I stuck with C.

View file

@ -89,7 +89,7 @@ type StatementBlockNode struct {
// ================================================================
// This is for any right-hand side (RHS) of an assignment statement. Also, for
// computed field names on the left-hand side, like '$a . $b' in mlr put '$[$a
// . $b]' = $x + $y'.
// . $b]' = $x + $y'. Also known as an "Rvalue".
type IEvaluable interface {
Evaluate(state *State) lib.Mlrval
}
@ -108,3 +108,10 @@ func NewEvaluablePair(key IEvaluable, value IEvaluable) *EvaluablePair {
Value: value,
}
}
// ================================================================
// This is for any left-hand side (LHS) of an assignment statement.
// Also known as an "Lvalue".
type IAssignable interface {
Assign(state *State, mlrval lib.Mlrval) error
}

View file

@ -58,6 +58,10 @@ TOP OF LIST:
o --headerless-csv-output
o new non-lite DKVP reader/writer
* simplify the DSL
o Lvalue rule
o single assignment type with left-child implementing a new Assignable interface
* widen DSL coverage
o begin/end blocks
o indirect field names, at LHS and RHS
@ -68,6 +72,7 @@ MAYBE:
* string index/slice access
* string/array slices on assignment LHS -- ?
* push/pop/shift/unshift subroutines
----------------------------------------------------------------
GOCC UPSTREAMS:
@ -114,3 +119,4 @@ NITS/NON-IMMEDIATE:
a big red flag though for things like the repeat verb (maybe *only* that one ...)
! clean up the AST API. ish! :^/
* defer reg_test/run until there is quite a bit more verb/dsl/io expansion
* doc: no boolish truthy falsy