module Sus::File

def self.[] path

def self.[] path
	self.build(Sus.base, path)
end

def self.build(parent, path)

def self.build(parent, path)
	base = Class.new(parent)
	
	base.extend(File)
	base.description = path
	base.identity = Identity.file(parent.identity, path)
	base.set_temporary_name("#{self}[#{path}]")
	
	begin
		TOPLEVEL_CLASS_EVAL.call(base, path)
	rescue StandardError, LoadError, SyntaxError => error
		# We add this as a child of the base class so that it is included in the tree under the file rather than completely replacing it, which can be confusing:
		base.add FileLoadError.build(self, path, error)
	end
	
	return base
end

def self.extended(base)

def self.extended(base)
	base.children = Hash.new
end

def print(output)

def print(output)
	output.write("file ", :path, self.identity, :reset)
end