You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the most basic cases, where a function is indeed only either successful or not, bool should always be used.
In cases where a non-successful result carries more information, an enum should be used. For example, lxt_parse, which can hit several different failures, should return which exact failure it hit (e.g. max containers, entries etc.).
It might even be worthwhile to go further than just simple enums and instead return stateful information so that the library can report exactly where and why something went wrong; e.g. parsing errors at line and column numbers. But that is probably better fit as a separate issue.
The text was updated successfully, but these errors were encountered:
In the most basic cases, where a function is indeed only either successful or not,
bool
should always be used.In cases where a non-successful result carries more information, an enum should be used. For example,
lxt_parse
, which can hit several different failures, should return which exact failure it hit (e.g. max containers, entries etc.).It might even be worthwhile to go further than just simple enums and instead return stateful information so that the library can report exactly where and why something went wrong; e.g. parsing errors at line and column numbers. But that is probably better fit as a separate issue.
The text was updated successfully, but these errors were encountered: