On 14/09/2006, at 9:42 AM, Adelle Hartley wrote:

Andre Pang wrote:
I think dynamic typing's actually a total cop-out.  There is
exactly one sceneario where dynamic typing is necessary and
useful, which is when you are loading unknown code at
run-time (e.g. plugins) and you have no idea what that code
could potentially do.  Dynamic typing is useful there since
you're actually doing type-checking of the code you're
loading and ensuring that it's at least of the correct type[1].

Is it even necessary then? Why should plugins not be of type "Plugin"?

Well, you don't have to typecheck plugins. If you don't, though, your program will simply segfault :). If you don't typecheck, you simply have a random pointer you know nothing about, and are expecting it to be (1) proper code, and (2) accept and return exactly the correct types for its parameters and return value. (Note that is exactly what you do in C when you get at a plugin's function via dlsym () and cast it from a void* to whatever function type you think it's meant to be...).

I think this kind of syntax is a lot clearer if the language has a string
concatentation operator which is typographically distinguishable from
numeric addition, but it is probably a symptom of not having in-string
expression evaluation.

Agreed: Haskell has ++ for list concatenation and Perl uses a dot (.) for string concatenation, both of which make things much clearer. (And Objective-C has a method named stringByAppendingString:, which is about as clear as you can get ;).


--
% Andre Pang : trust.in.love.to.save  <http://www.algorithm.com.au/>



_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders

Reply via email to