Login
You're viewing the code4lib.social public feed.
  • Jul 29, 2025, 7:11 PM

    @gklyne neato, thanks for sharing. are you storing the json-ld data in any kind of data store? I've recently been working a bit with ad-hoc json-ld being submitted to an API and have found the framing support in Python's pyld.jsonld to be pretty valuable. Have you needed to do anything like that from Rust?

    💬 1🔄 0⭐ 0

Replies

  • 💬 1🔄 0⭐ 0
  • Jul 30, 2025, 8:13 AM

    @gklyne @edsu thanks for sharing that @edsu - when it got to the discussion of anti-patterns I discovered a lot of places I could improve my code 😂

    💬 1🔄 0⭐ 0
  • Jul 30, 2025, 8:23 AM

    @edsu @paulwalk Ah, yes: he mentions (excessive) use of .unwrap() as one. I’ve found that using ‘?’ operator, which can be easy to overlook, helps keep the code concise without losing control of the possible errors. Also there are some interesting fluent operations (e.g. .and_then(…), IIRC) that allow handling of wrapped values (more ideas from the functional programming universe).

    💬 2🔄 0⭐ 0
  • Jul 30, 2025, 8:28 AM

    @gklyne @edsu yes - I have plenty of code snippets from online examples that I have copy pasted that use unwrap a lot. Revisiting these now. Also - I really haven’t mastered pointers (one of the things I like in Golang) so have been using clone() a lot, but reluctantly…

    💬 0🔄 0⭐ 0
  • Jul 30, 2025, 9:03 AM

    @gklyne @edsu Yes - once I understood the use of the error trait properly and started to use "?" to propagate errors I felt more comfortable. But like the podcast guy said, it's easy to reach for unwrap in trivial cases, and that can become a little too habitual I guess. So, I'm now "unwrapping" some of my "unwraps" :-)

    💬 1🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0