Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: cyclic value construction ("let rec")
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <mottl@m...>
Subject: Re: cyclic value construction ("let rec")
> Alas, it can do a lot of harm.  For one thing, you could break type
> safety this way, just like with polymorphic references:

Oh, right... - I could have thought earlier of this eternal problem of
destructive update and polymorphic typing! Once again it seems to me that
there is little place to "wiggle" at the current implementation of the
typing discipline without losing its important properties...

So my "quick hack" version is indeed potentially explosive and will only
work correctly (= type safe) as long as the user does not put polymorphic
values into the datastructure and does not do "evil" things then.

It would be possible to allow this "const cast" with records that have a
non-parameterized type - which would be pretty boring and might possibly
make the language less regular: beginners might be confused why "casting
away" mutability is allowed in some cases but not in others.

Best regards,
Markus Mottl

-- 
Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl