In a previous life, this was one of the problems we had with 
generate-and-execute. 

In lisp, you could almost always create correct code and run it.  With C, I 
could generate library interposers by the ton, but they only *usually* 
worked, so I had to generate unit tests, too. Fortunately I had a mad 
colleague who loved generating tests (;-))

I wonder how many corner cases there are in C++/Java/Rust/whatever generics 
of exactly this sort?

--dave

On Friday, March 31, 2017 at 1:21:02 PM UTC-4, Michael Jones wrote:
>
> yes
>
> On Fri, Mar 31, 2017 at 12:30 PM, Ian Davis <m...@iandavis.com 
> <javascript:>> wrote:
>
>> On Fri, 31 Mar 2017, at 05:19 PM, Michael Jones wrote:
>>
>> There is part of the topic that has always been slightly beyond my grasp. 
>> (Maybe I do understand...but just lack absolute certainty.) Maybe others 
>> know the answer...
>>
>> In a template system (which is what I prefer but that's not the point of 
>> this email) we have the notion of the TYPE(s) being a formal argument. We 
>> presume that the code will compile or fail based on the suitability of the 
>> instantiated type. That is, a templated Min would fail on the comparison 
>> "<" if the TYPE was "Map[something]something." Call that a lexical fail. 
>>
>> My question is, what about a semantic fail. Say, "<" for floating point. 
>> In the sort package the Less function does !Less(a,b)&&!Less(b,a) to figure 
>> out Equal(a,b). That works for ints and strings, but when I templated sort 
>> I found that it failed in tests with float32 and float64 because of NaN 
>> values, which are !Less(a,b)&&!Less(b,a) yet !Equal(a,b). I had to make two 
>> templates, one for floating point values and one for integral/string values.
>>
>>
>> Is this because sort.Less requires total ordering and, because of NaN, < 
>> for floats only offers partial ordering?
>>
>> Ian
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Michael T. Jones
> michae...@gmail.com <javascript:>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to