TVL depot development (mail to depot@tvl.su)
 help / color / mirror / code / Atom feed
From: Ryan Lahfa <tvl@lahfa•xyz>
To: depot@tazj.in
Cc: flokli@flokli•de, Ryan Lahfa <tvl@lahfa•xyz>
Subject: [PATCH 0/2] Implement serde::Deserialize for Value
Date: Sat, 24 Dec 2022 18:27:44 +0100	[thread overview]
Message-ID: <20221224172745.3104453-1-tvl@lahfa.xyz> (raw)

As per IRC discussions, this tries to bring an impl of
serde::Deserialize for Value.

Various questions are:

- Do we want to keep the ugly #[serde(skip)] for the other values?
  - I think it's quite neat to know it _should be possible_ to serialize
    as-is a Value structure, but I feel like there's two policies of
    serialization.
    A public-facing one and an internal one.
- Do we want to introduce `serde_test` to perform ad-hoc unit testing of
  the deserialization process?
- Performance testing? It seems like the #[derive] stuff is generating
  fast enough deserialization, similar to handwritten ones.
- Conversion from ErrorKind to serde errors?
  - I see there is a Error paired with a ErrorKind and a Span, I'm not
    sure we can get the Span in the deserialization process without
    being too involved.
  - I am not sure I see a way to convert a "partial" string and let
    serde fill the rest, with the span itself for example.

Ryan Lahfa (2):
  feat(tvix/eval): implement From<f64> for Value
  feat(tvix/eval): implement serde::Deserialize for Value

 tvix/eval/Cargo.toml                          |  2 +-
 tvix/eval/src/builtins/mod.rs                 |  4 +-
 .../tests/tvix_tests/eval-okay-fromjson.exp   |  2 +-
 .../tests/tvix_tests/eval-okay-fromjson.nix   |  1 +
 tvix/eval/src/value/attrs.rs                  | 39 ++++++++++-
 tvix/eval/src/value/list.rs                   |  4 +-
 tvix/eval/src/value/mod.rs                    | 65 ++++++-------------
 tvix/eval/src/value/string.rs                 | 34 ++++++++++
 8 files changed, 101 insertions(+), 50 deletions(-)

-- 
2.38.1



             reply	other threads:[~2022-12-24 17:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-24 17:27 Ryan Lahfa [this message]
2022-12-24 17:27 ` [PATCH 1/2] feat(tvix/eval): implement From<f64> " Ryan Lahfa
2022-12-24 17:27 ` [PATCH 2/2] feat(tvix/eval): implement serde::Deserialize " Ryan Lahfa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221224172745.3104453-1-tvl@lahfa.xyz \
    --to=tvl@lahfa$(echo .)xyz \
    --cc=depot@tazj.in \
    --cc=flokli@flokli$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://code.tvl.fyi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).