[m-dev.] fix for bytecode generator
Bert Thompson
aet at cs.mu.oz.au
Wed Mar 19 19:43:53 AEDT 1997
|Hi Bert,
|
|Could you please review these changes.
|
|Simon.
Gday Simon,
The change looks great.
One observation however...
|+ % Everything other than characters should
|+ % be module qualified.
|+ Functor = unqualified(FunctorName),
|+ string__to_char_list(FunctorName, FunctorList),
|+ ( FunctorList = [Char] ->
|+ ByteConsId = char_const(Char)
|+ ;
|+ error("bytecode_gen__map_cons_id: unqualified c
|ons_id is not a char_const")
|+ )
| ;
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.
Advantages of this are:
- The typechecker prevents us from using an invalid
data representation such as unqualified("Not a single char").
- No longer need tests that `unqualified(string)' represents
a character constant.
- There's one less place where the compiler can fail with
a runtime error.
Bert
More information about the developers
mailing list