[m-dev.] another interface file?

Zoltan Somogyi zs at csse.unimelb.edu.au
Wed Jun 10 17:34:46 AEST 2009


On 10-Jun-2009, Zoltan Somogyi <zs at csse.unimelb.edu.au> wrote:
> It seems that you want to find the place where .int files are written out,
> and change the condition on WHEN you write out the definitions of
> abstract-exported types.

I intend soon to take up something I dropped at the end of last year
that should have a bearing on this: changing the representation of
the import_status type. Before I can do so, we should have a discussion
about what should replace it. Attached are the two proposals I made on nov 3
last year, to start the discussion.

We could have the discussion online, but having it in person would be better.
Who is interested, and when are you free?

Zoltan.
-------------- next part --------------
%-----------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et

:- type gen_status
    --->    gen_status(
                gen_mercury_status,
                gen_target_status
            ).

:- type gen_target_status
    --->    gen_target_defined_in_this_module
    ;       gen_target_defined_in_other_module
    ;       gen_target_defined_external.

:- type gen_mercury_status
    --->    gen_mercury_defined_in_this_module(
                gen_mercury_export_status
            )
    ;       gen_mercury_defined_in_other_module(
                gen_mercury_import_status
            ).

:- type gen_mercury_export_status
    --->    gen_mercury_no_export
            % Not exported to anyone.

    ;       gen_mercury_export_to_all
            % Export to every module.

    ;       gen_mercury_export_to_submodules
            % Export only to submodules.

    ;       gen_mercury_pseudo_export_to_all
            % For unify predicates: export only proc 0.

    ;       gen_mercury_opt_export_to_all.
            % Export the predicate only for optimization.

:- type gen_mercury_import_status
    --->    gen_mercury_imported(import_locn)
            % Imported the interface.

    ;       gen_mercury_pseudo_imported
            % For unify predicates: import only proc 0

    ;       gen_mercury_opt_imported.
            % Imported the predicate only for optimization.

%-----------------------------------------------------------------------------%

:- type type_status
    --->    type_defined_in_this_module(
                type_export_status
            )
    ;       type_defined_in_other_module(
                type_import_status
            )
    ;       type_target_builtin.

:- type type_export_status
    --->    type_no_export
            % Not exported to anyone.

    ;       type_export_to_all
            % Export the whole type definition to all modules.

    ;       type_export_to_submodules
            % Export the whole type definition, but only to submodules.

    ;       type_abstract_export_to_all
            % Export only the type constructor to all modules.

    ;       type_opt_export_to_all.
            % Export the type only for optimization.
            % XXX: What about types whose declaration is the interface section
            % and whose definition is in the implementation section, but whose
            % definition we want to opt_export anyway?

:- type type_import_status
    --->    type_imported(import_locn)
            % Imported the whole type definition.

    ;       type_abstract_imported
            % Imported only the type constructor.

    ;       type_opt_imported.
            % Imported the type only for optimization.
            % XXX: What about types whose declaration is the interface section
            % of another module and whose definition is in the implementation
            % section of that other module, but whose definition we want
            % to opt_import anyway?
-------------- next part --------------
%-----------------------------------------------------------------------------%
% vim: ft=mercury ts=4 sw=4 et

:- type code_status
    --->    code_status(
                code_mercury_status,
                code_target_status
            ).

:- type code_target_status
    --->    code_target_defined_in_this_module
    ;       code_target_defined_in_other_module
    ;       code_target_defined_external.

:- type code_mercury_status
    --->    code_mercury_defined_in_this_module(
                code_is_pseudo_export       :: code_is_pseudo_export,
                % If this field says code_is_pseudo_export, then the other
                % three fields apply only to procedure 0; all other procedures
                % of this predicate are not exported to anyone.

                code_export_to_submodules   :: code_export_to_submodules,
                % Will be set to code_no_export_to_submodules if we do not yet
                % know whether the module HAS submodules.

                code_export_plain           :: code_export,
                code_export_opt             :: maybe(code_opt_export)
            )
    ;       code_mercury_defined_in_other_module(
                code_is_pseudo_import       :: code_is_pseudo_import,
                % If this field says code_is_pseudo_import, then the other
                % two fields apply only to procedure 0; we don't import
                % any other procedures of this predicate.

                code_import_plain           :: import_locn,
                % Plain imports always import only predicates' declarations,
                % never their definitions.
                code_import_opt             :: maybe(code_opt_import)
            ).

:- type code_export_to_submodules
    --->    code_export_to_submodules
    ;       code_no_export_to_submodules.

:- type code_is_pseudo_export
    --->    code_is_pseudo_export
    ;       code_is_not_pseudo_export.

:- type code_is_pseudo_impport
    --->    code_is_pseudo_impport
    ;       code_is_not_pseudo_impport.

:- type code_export
    --->    code_export_decl
    ;       code_do_not_export_decl.

:- type code_opt_export
    --->    code_opt_export_decl_only
    ;       code_opt_export_decl_and_defn.

:- type code_opt_import
    --->    code_opt_import_decl_only
    ;       code_opt_import_decl_and_defn.

%-----------------------------------------------------------------------------%

:- type type_status
    --->    type_defined_in_this_module(
                type_export_to_submodules   :: type_export_to_submodules,
                % Will be set to type_no_export_to_submodules if we do not yet
                % know whether the module HAS submodules.

                type_export_plain           :: type_export,
                type_export_opt             :: maybe(type_export)
                % The opt field, if present, cannot export less than the plain
                % field.
            )
    ;       type_defined_in_other_module(
                type_import_plain           :: type_import(import_locn),
                type_import_opt             :: maybe(type_import(unit))
                % The opt field, if present, cannot import less than
                % the plain field.
            )
    ;       type_builtin.

:- type type_export_to_submodules
    --->    type_export_to_submodules
    ;       type_no_export_to_submodules.

:- type type_export
    ;       type_export_whole_defn
            % Export the whole type definition.
    ;       type_export_ctor_only
            % Export only the type constructor.
    ;       type_export_nothing.

:- type type_import(T)
    ;       type_import_whole_defn(T)
            % Import the whole type definition.
    ;       type_import_ctor_only(T).
            % Import only the type constructor.


More information about the developers mailing list