breese / trial.protocol

Network wire protocols
11 stars 4 forks source link

Should `category() == token::category::data` really be a precondition? #10

Closed vinipsmaker2 closed 7 years ago

vinipsmaker2 commented 7 years ago

I mean, reader::value<T>() will already do a switch on symbol to possibly throw a runtime error. This precondition makes the API easier to use wrong and I fail to see a benefit on this.

Btw, we're using trial.protocol "heavily" (all JSON messages) on our new project at BlinkTrade, so if you need to advertise "is there a real usage case?", you can mention it (only boring thing til now is the increased number of assert(false) and code complexity thanks to #3).

breese commented 7 years ago

You are right. I have removed the pre-condition in e1d8cef3dfb8da206a6d4b310bb5953567aaf14a, and added some test cases instead.

Good idea about the advertising. I will add that to the readme.md file when I have added a library synopsis there.

vinipsmaker commented 7 years ago

Thanks. I predict I heavier usage of the parser (the dynamic::variable) on our code base once we start to rewrite one other of our projects in C++ too. If we use more features of the parser there, I may come back with more feedback.

Thanks for the excellent library so far.