In general, who should do more work: popFront or front?

Ali Çehreli acehreli at yahoo.com
Tue Jun 15 12:46:10 UTC 2021


On 6/14/21 10:17 PM, mw wrote:

 > I think there is another convention (although it's not formally
 > enforced, but should be) is:
 >
 > -- `obj.front() [should be] const`, i.e. it shouldn't modify `obj`, so
 > can be called multiple times at any given state, and produce the same
 > result

In other words, front() should be "idempotent".

To the OP, there is the following presentation that is related and 
touches on similar concerns:

   https://forum.dlang.org/thread/diexjstekiyzgxlicnts@forum.dlang.org

Ali



More information about the Digitalmars-d-learn mailing list