[m-dev.] fix for bytecode generator
Bert Thompson
aet at cs.mu.oz.au
Thu Mar 20 00:14:49 AEDT 1997
|Hi Bert,
|
|> 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
|
|If we were to add a specialised representation of characters, it would go
|into the cons_id data type, as was done for byte_cons_id.
Yes, that makes much more sense.
|> This simplifies the code, but means changing other code that uses
|> `unqualified(string)' to represent a char constant.
|
|Should characters be treated differently to other enumeration types?
For the sake of minimality, no. For efficiency, yes.
|Currently the only places characters are treated separately are
|code_util__cons_id_to_tag and bytecode_gen__map_cons_id. If we
|did change the representation there would need to be a similar check
|in the code to do the conversion during mode analysis (overloading
|isn't resolved until after type-checking),
Yep, the change is not localised.
|so I don't think the change
|would actually save much.
You're right. It doesn't save much at all.
Miniscule though the saving may be, it's still true that less-than-optimal
fixes tend to beget other less-than-optimal-er fixes. Anyway, this isn't
a big deal, and I don't foresee Mercury dying a death of a thousand cuts
any time soon. 8^)
Bert
More information about the developers
mailing list