json-ld icon indicating copy to clipboard operation
json-ld copied to clipboard

Sync versions of `expand` & `compact`?

Open roper79 opened this issue 2 years ago • 1 comments

For a NoLoader use cases, i.e. "local" data, it would be nice to have sync versions of expand & compact. Of course, I am not sure how much trouble this would be, but from the user perspective async versions generally force you to a nasty async architecture of the whole codebase unnecessarily.

roper79 avatar Dec 20 '22 13:12 roper79

I've been thinking about that lately, I think It would be good to have that eventually. I'm concerned about code redundancy. The code base is already large, it would be absurdly large if I had to duplicate it into a sync version. I'd have to also duplicate every change, bug fix etc.

I need a way to write the code once and strip the async definition into a sync one automatically. I don't want to wrap everything inside a regular macro, so I'm looking for a procedural macro here.

timothee-haudebourg avatar Jan 05 '23 11:01 timothee-haudebourg

I've decided to not solve this issue. Providing a "sync" version of the JSON-LD processing API, in addition to the sync one, would be too much trouble for me. You can avoid making your whole code async using any block_on future implementation if required.

timothee-haudebourg avatar Apr 09 '24 12:04 timothee-haudebourg