From: jstern@... (Josh Stern) Date: 2001-01-16T05:40:02+09:00 Subject: [ruby-talk:9342] Re: 101 Misconceptions About Dynamic Languages Christian wrote: >Let's quit the small talk. OF COURSE, C++ is both strongly and statically >typed. That is a good description of what C++ *is*. It's not important to argue over usage. C++ has types, but it is not type-safe. The important reasons for this are not casts (as one might erroneously infer from the foregoing discussion), but rather the fact that it is possible to accidentally dereference invalid objects and write to invalid memory addresses. >Please describe to me the practical difference between an 'interpreted >language' and C++ with hot-swappable DLL's (without resorting to lame >excuses about compile times, given Mr Moore's hueristic). For starters, only the C++ compiler and not the programmer is given access to a parser and the outputs produced from the parser, such as the map linking string names and the objects they reference. If you want to dynamically read strings and then call functions based on the string contents, you need to roll your own parser and mappings - i.e. build your own interpreter. Since you are not getting the benefits of compiled speed, existing facilities, or true language standardization in these endeavors, it makes sense to many people to pick some other language that is optimized (by design) for interpreted use, such as Python, Perl, Lisp, or Ruby, and call your C/C++ compiled code from there. The downsides are that you still need to build wrappers for the existing code and think hard about the mappings between names, datatypes, and memory management strategies in the two domains (there is the less significant cost of learning a new syntax, but if you pick a good language, the new benefits of using it will outweigh that cost). >With .NET you can have your cake and eat it too: you can write Managed C++ >embedded in an XML file: it is both strongly typed and effectively >interpreted. >[..] >What is the practical difference between Managed C++ embedded in XML and >Ruby? Managed C++ is apparently a new choice for the interpreted domain; a choice which looks quite similar to C++. So it can be evaluated relative to usual set of criteria: a) is it cross platform b) is it open source c) it is fast d) is it flexible e) is it easy to write wrappers for calling compiled code d) is it easy to embed I don't know the answers to these questions. Perhaps you would like to fill in? My guess is that the answer to a) and b) are no, the answer to e) is that it is much like other other interpreted languages except that the mapping of data types is easier and you get some special shortcuts if your existing code is compiled with Microsoft's compiler (or perhaps you can only use it if your exising code is compiled with Microsoft's compiler?). >[..] >Meta-programming? C++. This is far more important than anything else. Templates are cool, but C++ doesn't natively provide much support for meta-programming. Compare C++ with Ruby or Common Lisp for the project of listing and/or serializing and later restoring all current system objects. -= Josh