At the moment there is no explicit entry point to F# programs, this maybe changed in later releases of F# as sometimes an explicit entry point is desirable - i.e. when you need to recover the command line args don't have the permisions to call System.Environment.GetCommandLineArgs(). However in most cases an explicit entry point is not necessary.

As you observerd, the whole of the last file passed to the compile forms the entry point. All top level binds and do statements in this file are eveluated in the order that they are defined in (top of file to bottom). All top level binds in other files eveluated just before a member of that module is used for the first time (under the hood this uses a .NET static construct). So it probably best to avoid Printf statement at the top level in your other files and use make that part of function definitions that are called from the last file past the compiler.

There are detail examples that show how this works in "Foundations of F#".

Cheers,
Rob

By on 11/25/2007 2:54 AM ()

Even if you don't have Foundations of F#, you can still get the code samples from:
[link:www.apress.com]

All samples relating to modules are in chapter 6.

By on 11/25/2007 3:03 AM ()

I actually do have your book. however I only just started going through it - still on chapter 3. Thanks for clarifying things for me!

By on 11/25/2007 7:34 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper