From: jstern@... (Josh Stern) Date: 2001-01-18T18:10:02+09:00 Subject: [ruby-talk:9499] Re: 101 Misconceptions About Dynamic Languages Christian wrote: >> Josh> The point of this part of the discussion was that there are >practical >> consequences to the lack of type safety in C++, for both "expert" >> and novices. Your claim that one can avoid that by using containers, >> references, and no casts, is not true in theory or in practice. >I don't understand what you mean by "lack of type safety in C++" (which was >the statement that started this entire thread). The terms 'type safe' and 'type safety' are commonly used in Computer Science, but they don't have a formal meaning independent of context. In the context of some particular language and syntax checking sytem, they can be given formalization by listing a set of sytem errors and then reasoning about whether or not the language and syntax checking system has a soundness property so that any piece of code which checks out can be proven not to be at risk for triggering one of these errors during execution. In the context of C++ it's understood that the syntax checking system is the compiler and things like dereferencing an invalid pointer are system errors - everything which is described as "undefined" system behavior in the ISO standard is a system error. For a language like Ruby, the analog is code that is parsed without complaint by the interpreter and the system errors would presumably include things like triggering "undefined method" exceptions. >> In Ruby and other dynamic languages, there are not separate stages. >> In C++, if one wants to use the full power of the C++ language to >> do the meta-programming, then it would be a separate stage and it >> would involve a system call to a compiler, which is not part of >> the language. Otherwise, one must work with unexpressive template >> meta language. > >I take your point. I could argue that partial specialisation in C++ is not >'unexpressive', except it would be a weak argument. The syntax can become >obtuse to say the least. Templates in C++ are very expressive and powerful for some purposes, especially compared to things like cpp defined macros in C. They are just very limited for meta-programming even if one accepts the limitation that everything must be defined at compile time. There are various efforts to overcome this with sophisticated pre-processing, for instance Open C++: http://www.hlla.is.tsukuba.ac.jp/~chiba/openc++.html -= Josh