[merd-devel] Re: welcome to merd-devel
Status: Pre-Alpha
Brought to you by:
pixel_
From: Pixel <pi...@ma...> - 2002-09-23 18:46:01
|
"Tommy Olesen" <to...@so...> writes: > > soundness i don't know yet. Maybe some things will have to rely on > > runtime checks a la Java. Hopefully it will happen only in weird > > cases. > > This was the compromise I was willing to take too, when I was > looking at this last (though I would perhaps prefer to force > the user to write the type check in the code rather than insert > it automatically, e.g., > > x : bool | int (sorry, it has been a while since I read about > merd, so I have forgotten the syntax) > y : int = cast<int>(x) + 42 for this example, this is a down-cast, and must be explicit. one day it could be: dynamic_cast(t) = (x !! t) -> x _ -> raise(Dynamic_cast) #=> dynamic_cast !! t -> x -> x !> Val(t); Val(t) to_Uint = dynamic_cast(Uint) #=> to_Uint !! x -> x !> Uint ; Uint though i'm not sure about the syntax of (x !! t) yet > > This way the user knows where he is paying a run-time cost). > > > Since the goal is not performance (well Perl/Python/Ruby performance > > is targeted), keeping many tags at runtime is no big deal. > > I agree. > > > > I saw some of your code (did not read it in detail). Have you > > > considered writing some type inference rules for the type system? > > > > you mean a more formal version than what's done in the code? Well not > > yet. The type inference rules are much based on the > > make-it-work-as-expected goal. I hope to consolidate things in the > > code, since currently they are many duplicated rewriting rules. > > Well, I suppose there is nothing more formal than code :-) Inference > rules give you a way of specifying what the rules should do and thus > some hope of finding bugs in the code, but of course it only shifts > the problem to the specification: how do you ensure there are no bugs > in the inference rules? i don't :-( for example I had a(b) | a(c) ==> a(b | c) which is not true (http://merd.net/types.html#co_and_contravariance) there may be other bugs awaiting :) |