Design Goals for Runtime module #433
Replies: 4 comments 4 replies
-
My personal main goal for (other formats besides pureconfig were supported, although I may drop everything except pureconfig for scala 3). Note that in the scala-2 world, there was no As you say, when unit information is run-time, all operations can fail, and so all of my operations return In terms of my goals for things like pureconfig ingestion, in a world with |
Beta Was this translation helpful? Give feedback.
-
@armanbilge I'm interested in your take on how this concept for However, it does require an entire parallel re-implementation of the operations, unit conversions, etc, and associated unit testing, so it would be some work for sure, and I'm trying to get a feel for what the benefits are to the community. As I explained above, my own primary interest is being able to parse external inputs at runtime. I actually think One approach could be to implement the pieces I need now, and adding a full parallel runtime universe could be deferred. |
Beta Was this translation helpful? Give feedback.
-
Here's another design question I am pondering: In the original scala-2 world, I parsed unit expressions that look like this: {"value": 1, "unit": "meter/second"} (see here) However, I proposed a somewhat more structured format to avro: {"value": 1, "unit": {"lhs": "meter", "op": "/", "rhs": "second"} } (see here) Clearly, the first is more human readable, however it has some drawbacks:
The second is not as easy for a human to read, however:
I'm actually leaning toward the second one, since pureconfig and most config libraries can ingest json and this design makes better use of json structures, and I can provide the json schema for checking if people want to take advantage of that. |
Beta Was this translation helpful? Give feedback.
-
Second option with a more structured unit definition seems entirely usable
to me. Can still be hand written when needed for examples, tests and docs.
…On Sat, 25 Feb 2023, 6:41 am Erik Erlandson, ***@***.***> wrote:
Here's another design question I am pondering: In the original scala-2
world, I parsed unit expressions that look like this:
{"value": 1, "unit": "meter/second"}
(see here
<https://github.com/erikerlandson/coulomb/tree/scala2/coulomb-pureconfig#examples>
)
However, I proposed a somewhat more structured format to avro:
{"value": 1, "unit": {"lhs": "meter", "op": "/", "rhs": "second"} }
(see here <https://github.com/erikerlandson/unit-analysis-json-schema>)
Clearly, the first is more human readable, however it has some drawbacks:
- it requires a dedicated parser
- it's expressions are also human authored and potentially more prone
to error
The second is not as easy for a human to read, however:
- it can leverage standard json parsers
- it can include checking using JSON schema specs, such as the one I
defined here
<https://github.com/erikerlandson/unit-analysis-json-schema/blob/master/unit-analysis-schema.json>
I'm actually leaning toward the second one, since pureconfig and most
config libraries can ingest json and this design makes better use of json
structures, and I can provide the json schema for checking if people want
to take advantage of that.
—
Reply to this email directly, view it on GitHub
<#433 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAXJZDECZON7N7ULNOWGRTWZEFHNANCNFSM6AAAAAAVE6FBLQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@erikerlandson Can you comment on the design goals of the new runtime module you are building?
If the unit check is done at runtime and fails, then we still have a runtime error. Is the main point that the resultant error is clearer, more precise, and potentially earlier?
Beta Was this translation helpful? Give feedback.
All reactions