[m-rev.] for review: merge foreign_type pragma on to the main branch
Peter Ross
peter.ross at miscrit.be
Wed Oct 24 19:18:27 AEST 2001
> > +to_type_string(c, foreign(Foreign)) =
> > + error("to_type_string: c NYI").
> > +to_type_string(csharp, foreign(Foreign)) = _ :-
> > + Result = sym_name_to_string(ForeignType, ".").
> > +to_type_string(managed_cplusplus, foreign(Foreign)) = _ :-
> > + Result = sym_name_to_string(ForeignType, ":") ++ " *".
> > +to_type_string(il, foreign(Foreign)) = _ :-
> > + error("to_type_string: il NYI").
>
> Use sorry/2 rather than error/1.
>
> Shouldn't all these NYI bits be implemented?
>
All will be revealed in the full diff.
> > +to_type_string(c, mercury(Type)) = Result :-
> > + ( Type = term__functor(term__atom("int"), [], _) ->
> > + Result = "MR_Integer"
> > + ; Type = term__functor(term__atom("float"), [], _) ->
> > + Result = "MR_Float"
> > + ; Type = term__functor(term__atom("string"), [], _) ->
> > + Result = "MR_String"
> > + ; Type = term__functor(term__atom("character"), [], _) ->
> > + Result = "MR_Char"
> > + ;
> > + Result = "MR_Word"
> > + ).
>
> Won't that do the wrong thing for type variables with --high-level-code?
> Shouldn't the type for those be "MR_Box"?
>
> Ah, thinking about it a bit more, I see that this code is correct.
> But a comment or two here, explaining why, might help.
>
I am glad it is correct, but that is not by design. I am just trying to
duplicate the existing functionality, so if you could provide a comment
as to why it is correct that would be great.
> Also, isn't this code the same as export__type_to_type_string?
> Why does this code need to be duplicated?
>
In the full diff, I am going to remove export__type_to_type_string and
replace all of its uses with the above interface. This was more a POC
(proof of concept) implementation. If you inspect it carefully you will
notice that it doesn't even come close to compiling.
Pete
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list