Path: news.daimi.aau.dk!news.uni-c.dk!newsfeed.sunet.se!news00.sunet.se!sunic!uunet!in2.uu.net!news.mathworks.com!newsfeed.internetmci.com!EU.net!Norway.EU.net!nntp.uio.no!NewsWatcher!user From: Kolbjorn.Aambo@ub.uio.no (Kolbjørn Aambø) Newsgroups: comp.lang.beta Subject: Re: Type checking, safety and templates Date: 26 Oct 1995 09:06:49 GMT Organization: University of Oslo Libray Lines: 82 Message-ID: References: <46in44$q42@krone.daimi.aau.dk> NNTP-Posting-Host: ubmac86.uio.no : : : > May this also serve as a reply to Kolbjørn Aambø . > He writes: > > >In the C++ Standard draft the STL part it is claimed that almost all > >Template related typechecking is *static*. Codegeneration is dependent > >on the types of the parameters given to the templates upond instansiation > >done during *Compiletime*. Compared to that BETA's virtual functions and > >attrivutes are per definition *DYNAMICALLY* CHECKED! > > Not so. I claim that the dynamic typechecking in Beta is the exception, > the rule being static typechecking, as discussed above. As far as I can > see, anything that you can do in C++, you can do in Beta and still > have type safety. The dynamic type checking is only introduced to > allow you to do assignments that can be meaningful, but yet would > be ruled out in C++ completely. > > >Until now I have only seen C++ compilers with bad error messages related > >to wrongly inplemented templates but... That is possibly more caused > >by sloppy programming than sloppe language... > > > >Still I agree that BETA is more understandable and easier to remember... > >still not intuitively evident.... > > > >Have I misunderstood anything? So then I think you should consider to have a quick port of STL to BETA. May be you are even able to make it easier to understand using inserted pattern for iterators etc.? As I remember from my little experience with BETA a lot of the typechecking is actually matching of exit and enter list length. So given that, how do you make a enter parameter so generic that it can take any type as input, probably as a pointer but that is not what templates does, they take static values that may vary considerably in size! max: (# a, b, c:@Integer; enter (a, b) do (if(true) //( a > b) then a -> c; else b -> c; if) exit c #); How can I make this max pattern find the max of ANY type that have relational operator > ? so it can behave like template T max(T a, T b) { return a>b?a:b; }; in C++ templates? I of course want alt those BETA max functions to have the same name... I guess that max: (# a, b, c:: b) then a -> c; else b -> c; if) exit c #); would NOT work I guess. If I want to use my own string definition for UNICODE for instance I know of no way to define the > infix relational operator.... So I pobably have to live with the FOTRAN like GT that I implement my self and that make my type less prominent than the build in basic pattern that have infix relational operators.... Please dont be too angry at me if I'm stupid, this is the only way for be to find out about this matters. By the way how is it going making a BETA on the Macintosh that don't require MPW?