Open percyqaz opened 2 years ago
especially useful for organising many related commands/variables
modules can really just be objects with a special syntax for accessing commands
Modules can really just be objects
module Mod
{
let bind = |x| -> 5
}
is a construct that creates an object with properties set to those bindings
and
Mod::bind arg1 arg2
calls a particular value exported by a module
The constructor doesn't need to exist for my current purposes, just the syntax for calling parts of modules
I like ::
more than :
because module:module:bind
looks less cool than module::module::bind
Also because of its similarity to C
Should modules be their own construct? Being values implies they can be passed into functions (I'm ok with this) Being objects implies all objects are modules for help purposes Being objects lets you inspect them in other ways (I think I'm ok with this)
Basically are first order modules useful -- Probably not because objects already exist
Yes overall I think it should be a separate concept to objects
I had an issue with the syntax construct and I can't remember what Anyway modules exist and can be defined from the F# environment end but not by scripts
Loose idea I have
Modules would have syntax like
Can then be loaded from files/maybe interop sources
Can call functions and variables via
MODULENAME::$variable
andMODULENAME::function ..args
Useful for having importable namespaces of shell features Useful for creating a standard library to drive the shell as a general purpose utility