[Issue 6495] array(file.byLine()) is a problem

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 1 10:15:07 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=6495


monarchdodra at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra at gmail.com


--- Comment #8 from monarchdodra at gmail.com 2013-08-01 10:15:05 PDT ---
(In reply to comment #7)
> Transient just means the value of .front changes when you call .popFront(), so
> you cannot simply assign .front to a variable and expect it to retain its value
> after you popFront(). Non-transient just means that you can assign .front to a
> variable and rest assured that popFront() will not mutate its value from under
> you.
> 
> I'm not sure we want to put this on the website just yet -- it *is* a term that
> we coined for the sake of distinguishing between, say, the current byLine(),
> which reuses the .front buffer, and the proposed change where it calls .dup on
> every line returned.

Not *quite* as simple as that. If front returns a "non reference type" (eg an
int) but by reference, is it transient?

struct S
{
    int front;
    void popFront()
    {++front;}
    enum empty = false;
}

int  a = myRange.front; //Non transient
int* b = &myRange.front; //Transient
myRange.popFront();
assert(*b == a); //Fails

Is that range transient? Is the range "reference transient"?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list