[m-dev.] fix for bytecode generator

Fergus Henderson fjh at cs.mu.oz.au
Thu Mar 20 12:59:42 AEDT 1997


Bert Thompson, you wrote:
> 
> Now let's stop beating this dead horse.

A fine suggestion.

However, if you criticize the code, and your criticisms are not
justified, then I must respond.

[Those bored with this issue should hit the appropriate key now.]

> |The savings would not be miniscule, they would be negative.
> 
> Incorrect.

I stand by that.

> I didn't propose to make characters any less of a special case.
> Read my suggestion again and the rationale below.
[...]
> Is it possible to avoid the test "FunctorList = [Char]"  by changing
> the declaration of sym_name prog_data.m to:
> 
> :- type sym_name 	---->	unqualified(string)	% Can remove?
> 			;	qualified(module_specifier, string)
> 			;	char_const(char).	% Added
> 
> and the above code to:
> 
> 			% Everything other than characters should
> 			% be module qualified.
> 			Functor = char_const(Char),
> 			ByteConsId = char_const(Char)
> 		;
> 
> This simplifies the code, but means changing other code that uses
> `unqualified(string)' to represent a char constant.

It may simplify _this_ particular piece of code, but I think it will
complicate other parts of the code.  Thus the net effect is not an
improvement.

> Advantages of this are:
> 	- The typechecker prevents us from using an invalid
> 	  data representation such as unqualified("Not a single char").

As I pointed out, you can't remove the `unqualified' functor, so
this advantage is non-existent.

> 	- No longer need tests that `unqualified(string)' represents
> 	  a character constant.

So?

As far as efficiency goes, this is not a bottleneck.
As far as simplicity goes, what simplicity you would gain here is
offset by additional complexity elsewhere.

> 	- There's one less place where the compiler can fail with
> 	  a runtime error.

The important thing is not the number of places, but the likelyhood of
failure.  I'm not convinced that your suggestion (or Simon's
suggested alternative) would decrease the likelyhood of failure.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list