[MLton] A Question on Property-List

BaoJian Hua huabj at mail.ustc.edu.cn
Fri Mar 16 03:03:45 PST 2007


hi, everyone,
     I've used MLton/SML for several years. And recently I'm reading some
MLton source code and trying to do some hacking (the so called ABCD
optimization pass on the SSA IL).
     But the extensive use of property list in MLton make me a little
confused, especially the "name space" problem. Consider the following
code:

(* Suppose there are two structures S1 and S2,
 * and in S1, some property P is added on the property list L of 
 * a variable, say x, and next, in structure S2, we want to update
 * or peek the property P. Obviously, this kind of information
 * propogation is common.
 *)
structure S1 : SIG1 =
struct
  (* generate a new property, which is retrieved by "peek1"
   *)
  val {peek = peek1, ...} = Plist.newProperty ()
  ...
end

structure S2 : SIG2 =
struct
  (* here, we want to peek the property added in structure S1
   *)
  val P = S1.peek1 (plist)
end

   But the problem is: if we don't want to include the definition
of "peek1" in signature SIG1, or even we don't want to mention the
SIG1£¬the function "peek1" is not visiable in S2, then how should
we peek the property P in S2?
   I'm not sure whether I've misundertood the functionality of
property list or there is some way to do this kind of hacking.
   Thanks in advance.


-Baojian Hua

Computer Science Department
Univercity of Science and Technology of China



More information about the MLton mailing list