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

2018-10-17 Thread Dennis via Digitalmars-d-learn
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.,

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

2018-10-17 Thread Stanislav Blinov via Digitalmars-d-learn
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.

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

2018-10-17 Thread Dukc via Digitalmars-d-learn
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

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

2018-10-16 Thread H. S. Teoh via Digitalmars-d-learn
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

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

2018-10-16 Thread Dennis via Digitalmars-d-learn
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