From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <200305082250.h48Mod527047@augusta.math.psu.edu> To: 9fans@cse.psu.edu Subject: Re: [9fans] same functions everywhere In-Reply-To: Your message of "Thu, 08 May 2003 20:52:23 BST." <8986775bc07178dcbeb4f12677ccf3aa@vitanuova.com> From: Dan Cross Date: Thu, 8 May 2003 18:50:39 -0400 Topicbox-Message-UUID: a5553fd8-eacb-11e9-9e20-41e7f4b1d025 > to be honest, where i've needed to sort something, i just paste in the > following code: > > [snip] > > and define suitable values for T and greater(), > e.g. > T: type int; > greater(a, b: int): int > { > return a>b; > } > > the function itself is byte-for-byte identical with the other places > it's used, and well debugged. > > since the actual code doesn't need to change at all, it's easily > verified as being the same as that in other places (and easily > searched for should a bug emerge. there are a few. > > i dislike cut&paste code in other circumstances, but this seems > different (as the code itself doesn't change, and the interface is > very narrow). maybe i'm hopelessly misguided! This is fine, but one question I have is why cut and paste instead of putting sort() and mergesort() into their own file and then including it after defining T and greater()? Just curious. - Dan C.