[MUD-Dev] Re: Bruce Sterling on Virtual Community goals

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Thu Oct 22 21:23:08 New Zealand Daylight Time 1998


[Bruce Mitchener, Jr.:]

 >>Is it strongly or weakly typed, or somewhere in the middle?
 >
 >Dynamic typing.  We have distinct types, but don't require you to declare
 >the type in advance.
 >
 >public method $user_bruce.test() {
 >    var foo;
 >
 >    foo = 1;
 >    foo = "lala";
 >
 >    return foo;
 >};
 >
 >That is valid and would return "lala".

As you can likely tell from some of my postings in this thread, I'm
quite keen on efficiency. So, my question about typing is related to
that. If I did something like:

    <function header> {
	var a, b;
	a = 1;
	b = "lala";
	return a + b;
    }

what would happen? Would there be a complaint at compile time (difficult
to do), or would everything be OK until run time? If the latter, then
that means that a large number of operations need to have type tests
added to them. For fast operations like, say, integer addition, that
penalty can be quite large. Alternatively, perhaps the '1' is converted
to a string, and string concatenation occurs?

Another aspect of the question relates to compile-time type mismatch
errors. With a strongly typed language, you get nearly all of those at
compile time, rather than only when the execution path bumps into them.
Does the ColdC compiler provide this kind of help to the programmer?

And yes, I know I'm in the minority in wanting these things! Perhaps
its because I have an abysmal memory, and whatever help the compiler
can give me is appreciated.

--
Chris Gray     cg at ami-cg.GraySage.Edmonton.AB.CA




More information about the MUD-Dev mailing list