<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">On May 21, 2018, at 5:32 AM, Ryan Schmidt <<a href="mailto:ryandesign@macports.org" class="">ryandesign@macports.org</a>> wrote:<br class=""><blockquote type="cite" class=""><br class="">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?<br class=""></blockquote><br class=""><div class="">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.</div><div class=""><br class=""></div><div class="">The cleanest way of defining a global const variable that I’ve come across is with trace, <a href="http://wiki.tcl.tk/398" class="">tying the variable to a write command with an explicit error message</a>.</div><div class=""><br class=""></div><div class="">But the Tcl wiki page that I linked to previously notes that "<span style="background-color: rgb(255, 255, 255);" class="">command names are the natural choice for constants:</span></div><ul style="background-color: rgb(255, 255, 255);" class=""><li class="">they live in a separate namespace to variables;</li><li class="">they are rarely redefined, and few commands do so;</li><li class="">global commands are available everywhere without importing;</li><li class="">they offer the possibility of byte-code optimization, i.e. inlining (no idea if this is or could be done).<font face="sans-serif" class=""><span style="font-size: 14.399999618530273px;" class="">”</span></font></li></ul><div class="">-AM</div></body></html>