On 7/30/2019 12:59 PM, Atlas Atlas wrote:
вторник, 30 июля 2019 г., 4:40:40 UTC+3 пользователь Sam Tobin-Hochstadt написал:


    I'm not exactly sure what you're asking for here -- the CL type
    system
    works very differently -- but local annotation is certainly possible
    in Typed Racket. The `ann` form allows you to annotate any expression
    at all, ie `(ann 17 Integer)`.

    Sam


The idea is you don't need to write this annotations. You can if you want.
In typed racket it is demand.
This became problem with untyped libraries, especially when they produce complex data. Or have complex macros.
Sometimes this catches you with iterations.

Simple example
(define (test-f a)
  (string-append a " okay"))
Typed-racket produces error: /"Type Checker: type mismatch expected: String given: Any"/ when type of _a_ can easily be inferred.
Solution is to infer type, or leave code untyped in some default way.

Another problem
require/typed - wraps code with contracts what have negative impact on performance, sometimes really bad one.
I just find current typed\racket condition unpractical.
I need for example to write my own untyped lib for using another untyped lib to simplify interfaces and make impact on performance more acceptable.

It seams what I am asking for here is unsound typing.

Latent typing ... what #lang Racket, Scheme and Lisp, etc. provide ... is not "unsound":  the data types are known and enforced, but the enforcement is at run time, and the result is that there are code size (type tests), data size (type tags or other metadata), and performance hits due to them.  The whole point of type declarations, type inferencing and so forth is to have the types known at compile time for sooner error diagnostics, and to increase performance by eliminating unneeded runtime testing.


Another option is to force! typed racket on all levels in all libs.

I am not so big expert in theory of language design..
There is some paper I found www.ccis.northeastern.edu/home/types/publications/gradual-dead/pre-treatment.pdf <http://www.ccis.northeastern.edu/home/types/publications/gradual-dead/pre-treatment.pdf> on this matter, called "Is Sound Gradual Typing Dead?" from Northeastern University, it highlights some of the problems in more scientific way.


George

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/130ed2ab-8b90-a0ad-3c27-fb7df73e6450%40comcast.net.

Reply via email to