Thread View: alt.lang.ml
2 messages
2 total messages
Started by Joel F. Klein
Sat, 31 Oct 1992 06:16
How do I define mutually dependent structures?
Author: Joel F. Klein
Date: Sat, 31 Oct 1992 06:16
Date: Sat, 31 Oct 1992 06:16
18 lines
1288 bytes
1288 bytes
Can I create two structures which are mutually dependent? Here is the sml code that describes what I want to do: signature asig = <<some signature>> signature bsig = <<some signature>> functor aFUN(structure s:bsig):asig = struct <<some structure>> end; functor bFUN(structure s:asig):bsig = struct <<some structure>> end; structure ta = aFUN(structure s=tb) and tb = bFUN(structure s=ta); SML-NJ tells me: std_in:6.33-6.34 Error: unbound structure tb std_in:6.63-6.64 Error: unbound structure ta Sigh. What advantage is there to using the "and" construct if SML can't figure out the mutual recursion? More importantly, am I doing something wrong? Joel F. Klein, email replies to kleinjf@cs.rose-hulman.edu
Re: How do I define mutually dependent structures?
Author: Stefan Kahrs
Date: Mon, 02 Nov 1992 11:13
Date: Mon, 02 Nov 1992 11:13
29 lines
1578 bytes
1578 bytes
In article <1ct8crINN1bt@master.cs.rose-hulman.edu> kleinjf@cs.rose-hulman.edu (Joel F. Klein) writes: > Can I create two structures which are mutually dependent? No. > Here is the sml code that describes what I want to do: > > signature asig = <<some signature>> > signature bsig = <<some signature>> > functor aFUN(structure s:bsig):asig = struct <<some structure>> end; > functor bFUN(structure s:asig):bsig = struct <<some structure>> end; > structure ta = aFUN(structure s=tb) and tb = bFUN(structure s=ta); > > SML-NJ tells me: > std_in:6.33-6.34 Error: unbound structure tb > std_in:6.63-6.64 Error: unbound structure ta ...which is absolutely correct. > Sigh. What advantage is there to using the "and" construct if SML can't > figure out the mutual recursion? More importantly, am I doing something > wrong? You don't do anything wrong. There are simply no recursive structure in SML, the "and" construct for structure bindings is certainly a bit misleading. -- Stefan Kahrs
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads