macports_version

Ryan Schmidt ryandesign at macports.org
Tue May 22 07:04:31 UTC 2018


On May 22, 2018, at 00:45, Andrew Moore wrote:

> On May 21, 2018, at 5:32 AM, Ryan Schmidt wrote:
> 
>> Yes I'm talking about $xcodeversion, and I'm wondering why we don't have a corresponding $macports_version. Why do we have to call a procedure to get the MacPorts version, when we don't have to call a procedure to get the Xcode version?
> 
> I could hazard a guess at how that came to be, but I’ll  assume that you’re wondering why it can’t be otherwise.  The answer, of course, is that it could.
> 
> The cleanest way of defining a global const variable that I’ve come across is with trace, tying the variable to a write command with an explicit error message.
> 
> But the Tcl wiki page that I linked to previously notes that "command names are the natural choice for constants:
> 	• they live in a separate namespace to variables;
> 	• they are rarely redefined, and few commands do so;
> 	• global commands are available everywhere without importing;
> 	• they offer the possibility of byte-code optimization, i.e. inlining (no idea if this is or could be done).”

Yes, I know that variables can be made read-only through a trace. MacPorts base has a feature built around traces called option_proc. So my question is why it wasn't done that way.

Clemens, do you remember?

https://trac.macports.org/changeset/134511





More information about the macports-dev mailing list