class Ven::Master

Overview

An abstraction over an implicit collection of Inputs.

Implements Ven module system (e.g., distinct and expose).

Note that all files in the current directory (CD), as well as the files of #homes, are made into Inputs. But only those that were exposed are compiled and executed.

master = Master.new
master.load("a", "x = 1 + 1")
master.load("b", "y = 2 + x")
master.load("c", "say(x, y)") # STDOUT: 2 \n 4

Included Modules

Defined in:

ven/master.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(homes : Array(String) = [Dir.current]) #

[View source]

Instance Method Detail

def debug(message : String) #

Prints a colorized debug message if #verbosity allows.


[View source]
def gather #

Searches for '.ven' files in this Master's homes.

A new Input is added to the repository for each '.ven' file. A warning will be shown if it cannot be read (if allowed by #verbosity).


[View source]
def homes : Array(String) #

Directories where this Master will search for '.ven' files.


[View source]
def import(expose : Distinct) #

Imports a distinct expose.

This method will only work if all Inputs are being evaluated in a common environment.


[View source]
def inspect : Bool #

[View source]
def inspect=(inspect : Bool) #

[View source]
def load(file : String, source : String) #

Reads, compiles and executes source under filename file.


[View source]
def measure : Bool #

[View source]
def measure=(measure : Bool) #

[View source]
def passes : Int32 #

The amount of optimization passes.


[View source]
def passes=(passes : Int32) #

The amount of optimization passes.


[View source]
def timetable : Machine::Timetable | Nil #

The timetable produced by the latest #load.


[View source]
def to_s(io) #

[View source]
def verbosity : Int32 #

Currently, there are several levels of verbosity:

  • 0: totally quiet;
  • 1: only issue warnings (default);
  • 2: issue warnings and debug prints.

[View source]
def verbosity=(verbosity : Int32) #

Currently, there are several levels of verbosity:

  • 0: totally quiet;
  • 1: only issue warnings (default);
  • 2: issue warnings and debug prints.

[View source]
def warn(warning : String) #

Prints a colorized warning if #verbosity allows.


[View source]