Dealing with ranges where front and popFront do the same logic / eager ranges

Dukc ajieskola at gmail.com
Wed Oct 17 09:53:22 UTC 2018


On Tuesday, 16 October 2018 at 22:59:50 UTC, Dennis wrote:
> [snip]

The first thing to consider for invalid tokens, at least for me, 
would be to either have popFront set empty to true, or set front 
to some value representing a parsing error. A programming 
language parser almost certainly needs to output helpful error 
messages, so the latter is likely a better approach.

Whatever iterates through the range could then throw an 
appopriate exception when it encounters an error token.

I'm not saying your approach is wrong though. It's probably just 
a matter of taste.



More information about the Digitalmars-d-learn mailing list