[m-rev.] for review: submodules in the same assembly

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Aug 9 23:19:55 AEST 2001


On 09-Aug-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> Place sub-modules in the same assembly as their parent on the IL
> backend.
> 
> This allowes the user to decide how their application should be
> packaged.  If the user wishes their application to be deployed as one
> assembly then they should use sub modules.

It would be nice to document that somewhere,
e.g. README.DotNet, the user guide, and/or the web page.

> +++ compiler/ilds.m	9 Aug 2001 12:11:08 -0000
> @@ -63,7 +63,19 @@
> -:- type assembly_name == ilds__id. 
> +	% If we are referencing a sub-module, then we need to record two
> +	% names.  One is the sub-module name, which is used for
> +	% references from the parent module, and the other is the
> +	% assembly name for when the name is referenced from anywhere
> +	% else.
> +:- type assembly_name
> +	--->	module(
> +			il_module_name		:: ilds__id,
> +			containing_asm_name	:: ilds__id

Please spell that out in full, i.e. "containing_assembly_name".

> Index: compiler/mlds_to_il.m
> -		ThisAssembly = [assembly(AssemblyName)],
> +			% If the package name is qualified then the
> +			% we have a sub-module which shouldn't be placed
> +			% in it's own module.
> +		( PackageName = unqualified(_) ->
> +			ThisAssembly = [assembly(AssemblyName)]
> +		;
> +			ThisAssembly = []
> +		),

s/it's/its/

Did you mean to say "in its own _assembly_"?

> @@ -959,11 +960,11 @@
>  		)},
>  		{ RenameNode = (func(N) = list__map(RenameRets, N)) },
>  
> -		{ ExceptionClassName = structured_name("mscorlib",
> +		{ ExceptionClassName = structured_name(assembly("mscorlib"),
>  				["System", "Exception"]) },
>  
>  		{ ConsoleWriteName = class_member_name(structured_name(
> -				"mscorlib", ["System", "Console"]),
> +				assembly("mscorlib"), ["System", "Console"]),
>  				id("Write")) },

This code should use il_system_assembly_name
rather than hard-coding "mscorlib".

> Index: compiler/modules.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
> retrieving revision 1.189
> diff -u -r1.189 modules.m
> --- compiler/modules.m	7 Aug 2001 16:44:59 -0000	1.189
> +++ compiler/modules.m	9 Aug 2001 12:11:13 -0000
> @@ -2051,6 +2051,18 @@
>  
>  		globals__io_get_target(Target),
>  		globals__io_get_globals(Globals),
> +
> +		{ SubModules = submodules(ModuleName, AllDeps) },
> +		( { Target = il, SubModules \= [] } ->
> +			module_name_to_file_name(ModuleName, ".dll", no,
> +					DllFileName),
> +			io__write_strings(DepStream, [DllFileName, " : "]),
> +			write_dll_dependencies_list(SubModules, "", DepStream),
> +			io__nl(DepStream)
> +		;
> +			[]
> +		),
> +		

Copy the comment from the log message.

> +:- func submodules(module_name, list(module_name)) = list(module_name).
> +
> +submodules(Module, Modules0) = Modules :-
> +	( Module = unqualified(Str), \+ mercury_std_library_module(Str) ->
> +		P = (pred(M::in) is semidet :-
> +			Str = outermost_qualifier(M),
> +			M \= Module
> +		),
> +		list__filter(P, Modules0, Modules)
> +	;
> +		Modules = []
>  	).

A comment or two here would help.

Otherwise that looks fine.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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