<div dir="ltr"><br><br><div class="gmail_quote">On Wed, Mar 18, 2015 at 5:11 PM Alexis King <<a href="mailto:lexi.lambda@gmail.com">lexi.lambda@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It might be a good idea to have a special case for Values when producing error messages. Currently, even though the documentation mentions that Values is only valid as the return type of a function, the error messages can be a little confusing. For example, using Values as an expression produces the error “type name used out of context,” but it isn’t really a type.<br></blockquote><div><br></div><div>Yes, this is a good idea.</div><div><br></div><div>Sam</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> On Mar 18, 2015, at 14:01, Sam Tobin-Hochstadt <<a href="mailto:samth@cs.indiana.edu" target="_blank">samth@cs.indiana.edu</a>> wrote:<br>
><br>
> Type variables range only over types, and `(Values A B)` isn't a type.<br>
> If your program type checked, then the following program would too:<br>
><br>
> (: my-force : (All (A) (-> A) -> A))<br>
> (define (my-force f)<br>
>  (let ([tmp : A (f)]) tmp))<br>
><br>
> (my-force (lambda () (values (void) (void)))<br>
><br>
> but this program has a runtime error with the wrong number of values.<br>
><br>
> Sam<br>
><br>
> On Wed, Mar 18, 2015 at 4:48 PM, Benjamin Greenman <<a href="mailto:blg59@cornell.edu" target="_blank">blg59@cornell.edu</a>> wrote:<br>
>> Today I got a surprising type error that I think is worth sharing.<br>
>><br>
>> (: my-force (All (A) (-> (-> A) A))<br>
>> (define (my-force x) (x))<br>
>><br>
>> (my-force (lambda () (values (void) (void)))<br>
>> ;; ERROR! 'my-force' cannot be applied to argument.<br>
>> ;; expected "(-> A)", got "(-> (values Void Void))"<br>
>> ;; result type "A", expected result "AnyValues"<br>
>><br>
>> (inst my-force (Values Void Void))<br>
>> ;; Parse Error in type: "Values" is unbound<br>
>><br>
>> That is all. I see now that Values is only allowed in result positions, but<br>
>> I'd still expected this to work.<br>
>><br>
>><br>
>> ____________________<br>
>>  Racket Users list:<br>
>>  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/<u></u>users</a><br>
>><br>
> ____________________<br>
>  Racket Users list:<br>
>  <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/<u></u>users</a><br>
<br>
</blockquote></div></div>