[m-rev.] Add `.' as a module separator.

Ralph Becket rafe at cs.mu.OZ.AU
Tue Dec 3 18:37:31 AEDT 2002


Fergus Henderson, Tuesday,  3 December 2002:
> > 
> > You should also change the code to write module qualified terms.
> > Grep for "\":\"" in the compiler source.
> 
> I agree; however, I would be happy for that to come as a separate change.
> It would be OK for the compiler to support all three module qualifiers
> as input and to output module-qualifiers as ":".

I've nearly finished changing it to output "." - I might as well
complete the job.  I'll make it a separate change, though.

> However, another thing that needs to be done is to document the change
> in the language reference manual; that is something that I think should
> be done as part of this change, not as a separate change.

Done.

> > You should change the comment to mention that the associativity is
> > different to ISO Prolog.
> 
> Different to traditional Prolog, I think you mean.
> 
> I think the precedence for `.' should be changed to something very low,
> e.g. 10, rather than 600.  For example, I should be able to write
> 
> 	two_pi = 2 * math.pi.
> 
> but with the current precedences, this would parse as
> 
> 	two_pi = (2 * math).pi.

Changed precedence to 10.

Here are the diffs:

Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.263
diff -u -r1.263 reference_manual.texi
--- doc/reference_manual.texi	7 Nov 2002 06:14:09 -0000	1.263
+++ doc/reference_manual.texi	3 Dec 2002 07:25:06 -0000
@@ -439,7 +439,7 @@
 \/                yfx       500
 aditi_bottom_up   fx        500
 aditi_top_down    fx        500
-.                 xfy       600
+.                 yfx       10
 :                 yfx       600
 :=                xfx       650
 =^                xfx       650
@@ -3837,6 +3837,8 @@
 
 @node Modules
 @chapter Modules
+ at c XXX At some point in the future, change the rest of the documentation
+ at c     to use `.' as the module separator rather than `__'.
 
 @menu
 * The module system::
@@ -3899,18 +3901,20 @@
 
 The names of predicates, functions, constructors, constructor fields,
 types, modes, insts, type classes,
-and (sub-)modules can be explicitly module qualified using the @samp{:}
-operator, e.g.@: @samp{module:name} or @samp{module:submodule:name}.
+and (sub-)modules can be explicitly module qualified using the @samp{.}
+operator, e.g.@: @samp{module.name} or @samp{module.submodule.name}.
 This is useful both for readability and for resolving name conflicts.
 Uses of entities imported using @code{use_module} declarations
 @emph{must} be explicitly module qualified.
 
-Currently we also support @samp{__} as an alternative module qualifier,
-so you can write @code{module__name} instead of @code{module:name}.
-We are considering changing the module qualifier from @samp{:}
-to @samp{.} in a future version, so that we can use @samp{:} as
-a type qualifier instead.  Hence for the time being we recommend
-that you use @samp{__} rather than @samp{:} as module qualifier.
+Currently we also support @samp{__} and @samp{:} as an alternative
+module qualifier,
+so you can write @code{module__name} or @code{module:name} instead
+of @code{module.name}.
+We are considering changing the use of @samp{:} to being a type
+qualifier instead in a future version.
+Hence for the time being we recommend
+that you use @samp{.} rather than @samp{:} as module qualifier.
 
 Certain optimizations require information or source code for predicates
 defined in other modules to be as effective as possible.  At the moment,
@@ -4057,7 +4061,7 @@
 Each of the named sub-modules in an @samp{:- include_module} declaration
 must be defined in a separate source file.
 The mapping between module names and source file names is
-implementation-defined.  (For a module named @samp{foo:bar:baz},
+implementation-defined.  (For a module named @samp{foo.bar.baz},
 The University of Melbourne Mercury implementation requires the source
 to be located in a file named @file{foo.bar.baz.m}, @file{bar.baz.m},
 or @file{baz.m}.) 
Index: library/ops.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/ops.m,v
retrieving revision 1.40
diff -u -r1.40 ops.m
--- library/ops.m	9 Jul 2002 01:30:20 -0000	1.40
+++ library/ops.m	3 Dec 2002 07:15:25 -0000
@@ -264,7 +264,7 @@
 ops__op_table("--->", after, xfy, 1179).	% Mercury extension
 ops__op_table("-->", after, xfx, 1200).		% standard ISO Prolog
 ops__op_table("->", after, xfy, 1050).		% standard ISO Prolog
-ops__op_table(".", after, xfy, 600).		% traditional Prolog (not ISO)
+ops__op_table(".", after, yfx, 10).		% not traditional or ISO Prolog
 ops__op_table("/", after, yfx, 400).		% standard ISO Prolog
 ops__op_table("//", after, yfx, 400).		% standard ISO Prolog
 ops__op_table("/\\", after, yfx, 500).		% standard ISO Prolog

- Ralph
--------------------------------------------------------------------------
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