Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Partial implementation of "nameref", sort of.



On Jan 26, 11:05pm, Oliver Kiddle wrote:
}
} This is storing the string reference to the name, right? That is also
} what the somewhat more complete implementation from back in 15058 did

Indeed, I'd forgotten all about that.

I saw the shortcut that seemed to be possible by simply setting aspar
in paramsubst() and decided to see what I could do with it.

} At the time, my understanding of the consensus was that an
} implementation needed to instead use a pointer as the internal
} representation of the reference

There's now a tmpdata pointer in the Param struct which may not have been
present in 2001.  Perhaps it could be leveraged for this.

} (along with either reference counting or garbage collection).

Yeah, that's the tricky bit -- finding the namerefs in the event the
pointed-to variable is unset or goes out of scope.  There'd have to be
an intermediate struct that points in both directions, or something.

} It's a more useful feature in Ksh which has lexically scoped local
} variables. Ksh special cases nameref ref=$1 to take the referenced
} parameter from the parent scope which seems quite ugly to me. I'd prefer
} something more explicit like Tcl's uplevel command.

Agreed.



Messages sorted by: Reverse Date, Date, Thread, Author