On Fri, 11 Jan 2013 10:24:58 +0000 David Matthews David.Matthews@prolingua.co.uk wrote:
Ian> Is there an easy way (perhaps through the PolyML.Compiler Ian> structure) to get the depth of ` use "foo" ' stack at runtime?
David> I think the answer is probably "no" but I'm not clear exactly David> what you're asking. "stack" can mean a lot of things.
Let's call the hypothetical function use_depth. Then ideally it would behave like this:
$ poly
use_depth;
val it = fn: unit -> int
use_depth ();
val it = 0: int
$ cat level1.sml use_depth () $ poly
use "level1.sml";
val it = 1: int val it = (): unit
$ cat level2.sml use "level1.sml" $ poly
use "level2.sml";
val it = 2: int val it = (): unit val it = (): unit
I found another way to do what I want, so this is only of academic interest now.