Alexey Romanov

Results 50 comments of Alexey Romanov

What about a variant of `dbg` like ``` #define dbg_to(stream, ...) \ dbg::DebugOutput(__FILE__, __LINE__, __func__) \ .print(stream, {DBG_MAP(DBG_STRINGIFY, __VA_ARGS__)}, \ {DBG_MAP(DBG_TYPE_NAME, __VA_ARGS__)}, __VA_ARGS__) #define dbg(...) dbg_to(std::cerr, __VA_ARGS__) ``` and then...

Then I'll try to make a PR when I have free time.

Actually does it need to be in `namespace dbg` or can ADL let you use `pretty_print` in your own namespace?

Would it be good enough if `magic_get`-derived functionality was under `#ifdef __cplusplus`, so people using C++14 or later get it automatically and those limited to C++11 define `showValue` as usual?...

@julien-c I am planning to work on this (probably using https://docs.rs/cxx/0.5.6/cxx/).

I expect to make a draft PR this week (or early next week). It will only have enough classes for BERT tokenizer, to get feedback on the API and design....

One more question then (I was planning to ask in the draft PR, but can as well do it now). Report errors using exceptions or `expected` (which is like the...

A bit, yes (especially if they prefer a more "advanced" option like https://boostorg.github.io/leaf/). Actually, I thought of a way to make it configurable, so it will throw exceptions by default...

Looks like it does work (at least compiles): https://github.com/alexeyr/tokenizers/blob/c35c14833d3b2506616dd859dc73d550255201e2/bindings/cpp/src/tokenizers_util.h#L27-L48 https://github.com/alexeyr/tokenizers/blob/613e208ab5944e8f9d1488ff66947f8580f2d14d/bindings/cpp/src/redefine_result_tests.cpp#L5-L27 And if this approach runs into problems later, simply picking between exceptions and a single specific `Result`-like should work.

So it took much longer than expected, but here it is. The basic API is here: https://github.com/huggingface/tokenizers/blob/6358c2497d3e609376e9d2759730d0d3b2870955/bindings/cpp/tokenizers-cpp/tests.h#L77-L114