Wow, this is a blast from the past.<br><br><div class="gmail_quote">On Wed, Apr 9, 2008 at 12:57 PM, Andreas Raab <<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>> wrote:</div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
Question: Is there an implementation dependency for that or is it simply that VersionNumber is being overly paranoid here? In its current incarnation it's basically useless for me and I'd rather have the check be for negative numbers only.<br>
</blockquote><div class="gmail_quote"><span class="Apple-style-span" style="border-collapse: collapse;"><br class="webkit-block-placeholder"></span></div><div class="gmail_quote"><span class="Apple-style-span" style="border-collapse: collapse;">That's just a design decision I made. I felt was would be confusing to have version numbers "1" and "1.0" in the same lineage. When you create a branch, you would make "1.1" based on "1".</span></div>
<div class="gmail_quote"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="Ih2E3d">
John Thornborrow wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8x;border-left:1px #ccc solid;padding-left:1ex">
Wouldn't that just be "Version 1" ?<br>
</blockquote>
<br></div>
Simplified example. The real version number I'm interested in looks like "1.0.34". But it looks like VersionNumber is a no-go for me anyway as you can't even compare, e.g., '1.1.1' asVersion <= '1.2.3' asVersion. Does anyone actually use VersionNumber? I must be missing the real use cases for it.</blockquote>
<div><br class="webkit-block-placeholder"></div><div>I'm curious whether you'd expect this to return true or false (I'm guess true). The reason it refuses that compasion is that #< is meant to test whether a given version number is an ancestor of another. If you want the stringish comparison behavior, you could just use string. Or, you could extend the class with a different comparison method to do what you want. The motivation for this class was to give a structured way to used dotted number strings to encapsulate information about versions and branches. I've copied the class comments below.</div>
<div><br class="webkit-block-placeholder"></div><div>- Stephen</div><div><br class="webkit-block-placeholder"></div><div>---------------------</div><div><div>I am a version number. My representation allows me to handle an entire tree of versions. Once created, an instance should not change (note: VersionNumbers could be canonicalized like Symbols, but are not currently). </div>
<div><br class="webkit-block-placeholder"></div><div>I am a magnitude so that you can see if one version preceeds another (only if the two versions are in the same branch). </div><div>VersionNumber fromString: '1.0'.</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>'2.1' asVersion < '2.2.1' asVersion<span class="Apple-tab-span" style="white-space:pre">        </span>"true"</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>'2.3' asVersion < '2.2.1' asVersion<span class="Apple-tab-span" style="white-space:pre">        </span>"error different branches"</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>'2.3' asVersion inSameBranchAs: '2.2.1' asVersion<span class="Apple-tab-span" style="white-space:pre">        </span>"false, why the previous one failed."<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>'2.1' asVersion = '2.1' asVersion<span class="Apple-tab-span" style="white-space:pre">                </span>"true, obviously"</div><div><br class="webkit-block-placeholder">
</div><div>To get the next version number in the same branch:</div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>'2.3.4' asVersion next<span class="Apple-tab-span" style="white-space:pre">        </span>"2.3.5"</div>
<div><br class="webkit-block-placeholder"></div><div>To get the next version number, starting a new branch:</div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>'2.3.4' asVersion branchNext<span class="Apple-tab-span" style="white-space:pre">                </span>"<a href="http://2.3.4.1">2.3.4.1</a>"</div>
<div><br class="webkit-block-placeholder"></div><div>To get the common base version of any two version numbers (useful for merging):</div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>'2.3.8' asVersion commonBase: '<a href="http://2.3.4.1">2.3.4.1</a>' asVersion<span class="Apple-tab-span" style="white-space:pre">                </span>"2.3.4"</div>
<div><br class="webkit-block-placeholder"></div></div></div>