I've always been curious around the design choice of ranges to
make front and popFront separate functions, instead of having
popFront return the front. I suppose it is useful sometimes to be
able to access front multiple times without having to save it
temporarily (can't think of a specific exa
On Tue, Oct 16, 2018 at 10:59:50PM +, Dennis via Digitalmars-d-learn wrote:
> I've always been curious around the design choice of ranges to make
> front and popFront separate functions, instead of having popFront
> return the front. I suppose it is useful sometimes to be able to
> access front
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
On Wednesday, 17 October 2018 at 09:53:22 UTC, Dukc wrote:
Whatever iterates through the range could then throw an
appopriate exception when it encounters an error token.
Exceptions in a parser? Monsieur knows his perversion.
On Wednesday, 17 October 2018 at 00:12:13 UTC, H. S. Teoh wrote:
I'm not sure what's the reasoning behind the saying that
throwing exceptions in ctors is bad, but exceptions are exactly
the kind of thing designed for handling this sort of situation.
If the parser detects a problem early (i.e.,