[m-rev.] for review: merge foreign_type pragma on to the main branch

Tyson Dowd trd at cs.mu.OZ.AU
Wed Oct 24 14:42:32 AEST 2001


On 23-Oct-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> On Tue, Oct 23, 2001 at 05:06:38PM +1000, Tyson Dowd wrote:
> > > 
> > > compiler/mlds.m:
> > >     Table the result of export__type_to_type_string so as to avoid
> > >     passing the module_info around the MLDS backend.
> > 
> > I'm not really keen on this change, and I never have been.
> > The real thing I dislike is that we have to run
> > export__type_to_type_string every time we create a mercury_type in the
> > MLDS.
> > 
> > I would prefer 
> > 	- that export__type_to_type_string can work without the module_info.
> > or
> > 	- that we don't call export__type_to_type_string in the MLDS
> > 	  backend.
> > or
> > 	- that we call export__type_to_type_string much later in the
> > 	  MLDS, when we actually have to output a type.
> > 
> > Why can't the MLDS contain a map of all the foreign types?  Or the type
> > can contain maybe(type_defn_body) and be yes/1 for foreign types?
> > 
> 
> How about adding the following interface to foreign.m and then using it
> everywhere?

I think the approach is right, if you address the comments Fergus has
made, and I have a suggestion below.

> Index: foreign.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/foreign.m,v
> retrieving revision 1.7
> diff -u -r1.7 foreign.m
> --- foreign.m	23 Jul 2001 12:22:04 -0000	1.7
> +++ foreign.m	23 Oct 2001 14:31:56 -0000
> @@ -496,9 +496,82 @@
>  		FM = qualified(Module, Name ++ Ending)
>  	).
>  
> +%-----------------------------------------------------------------------------%
>  
> +:- import_module hlds_data.
>  
> +:- type export
> +	--->	foreign(sym_name)
> +	;	mercury((type)).

perhaps: 
	:- type export_type 
would be a better name?

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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