[racket] Typed racket problem

From: Manfred Lotz (manfred.lotz at arcor.de)
Date: Sun Nov 30 16:23:00 EST 2014

On Sun, 30 Nov 2014 15:26:09 -0500
Thanks, Vincent.

Vincent St-Amour <stamourv at ccs.neu.edu>
wrote:

> At Sun, 30 Nov 2014 16:38:02 +0100,
> Manfred Lotz wrote:
> > 1. You offered assert? as an alternative. Is this preferable in
> > comparison to cast?
> 
> Yes. Assertions are simple first order checks, and are quite
> inexpensive. Casts, on the other hand, use contracts and may require
> wrapping for mutable data or higher-order types.
> 

Aaah, good to know.


> > 2. My solution seems to be bad because the decision about the type
> > happens at runtime. 
> 
> I wouldn't be too worried about the cost of assertions, they're
> usually quite cheap. If you want to know whether assertions are
> slowing your program down, try using the `feature-profile` package.
> It reports the cost of various language features, including
> assertions.
> 

I accept it when it is cheap although I would prefer to be able to
work out the type thing at compile time.



-- 
Manfred 




Posted on the users mailing list.