Sam, thanks very much for the response. 

I only looked at the documentation for for/first after Dr Racket said "add 
more type annotations" a few times.  From a user viewpoint, I feel that a 
usually non-functioning form would benefit from an example of working usage 
so that I can bend my form to fit any limitations. In most places, 
transitioning my code to Typed Racket worked so easily that I came to 
expect my forms to work.

I'm glad that #:break is not a usage mistake, because I'm definitely 
replacing for/first with for/fold with a #:break. 

I'm not sure what to say on #:guard, except that it makes moving some 
non-TR code easier.

By the way, removing contracts and adding types on about 2500 lines 
resulted in about 10 LOC difference.  The speed of runtime code slightly 
favors TR.

-JG


On Saturday, January 27, 2018 at 3:33:44 PM UTC-5, Sam Tobin-Hochstadt 
wrote:
>
> Hi JG, 
>
> You're correct that the `for/first` and `for/last` forms don't work 
> usually in TR, but that's what the documentation says: "Like the 
> above, except they are not yet supported by the typechecker.". Is 
> there a different way that could be phrased to make this clearer? 
>
> The omission of `#:break` in the documentation is just an oversight. A 
> PR fixing that would be welcome, or I'll try to do it soon. 
>
> `#:guard` is not intended to be used, because the type checker doesn't 
> understand what it does. However, some existing TR code relies on the 
> current treatment, so it isn't an error. 
>
> Sam 
>
> On Fri, Jan 26, 2018 at 6:06 AM, JCG <griff...@gmail.com <javascript:>> 
> wrote: 
> > 
> > In doing some typed/racket, I have noticed some mismatch between 
> observed 
> > behavior and the documentation at 
> > 
> > https://docs.racket-lang.org/ts-reference/special-forms.html 
> > 
> > 1) Documentation suggests that for/first and for/last should work, yet 
> they 
> > seem to not type check.  I've noticed sparse comments to that effect 
> since 
> > 2014. 
> > 
> > 2) In working around for/first with for/fold, I discovered that #:break 
> > appears to function although the for loop documentation for typed racket 
> > (Section 2.3 in typed/racket reference) suggests that only the #:when 
> guard 
> > is a keyword in the for/ family syntax. 
> > 
> > 3) In the struct documentation for typed racket, the many for syntax 
> > keywords shown do not include #:guard, yet it seems to work. 
> > 
> > Are #:break and #:guard correct to use in typed/racket or are they 
> missing 
> > from the documentation intentionally? 
> > 
> > Thanks, 
> > JG 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Racket Users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to racket-users...@googlegroups.com <javascript:>. 
> > For more options, visit https://groups.google.com/d/optout. 
>

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

Reply via email to