corefmt

package
v0.0.0-...-48fa796 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the prefix given to all the functions in this module.
	ModuleName = "fmt"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PrintfFunc

type PrintfFunc struct {
	Type *types.Type // final full type of our function
	// contains filtered or unexported fields
}

PrintfFunc is a static polymorphic function that compiles a format string and returns the output as a string. It bases its output on the values passed in to it. It examines the type of the arguments at compile time and then determines the static function signature by parsing the format string and using that to determine the final function signature. One consequence of this is that the format string must be a static string which is known at compile time. This is reasonable, because if it was a reactive, changing string, then we could expect the type signature to change, which is not allowed in our statically typed language.

func (*PrintfFunc) ArgGen

func (obj *PrintfFunc) ArgGen(index int) (string, error)

ArgGen returns the Nth arg name for this function.

func (*PrintfFunc) Build

func (obj *PrintfFunc) Build(typ *types.Type) error

Build takes the now known function signature and stores it so that this function can appear to be static. That type is used to build our function statically.

func (*PrintfFunc) Close

func (obj *PrintfFunc) Close() error

Close runs some shutdown code for this function and turns off the stream.

func (*PrintfFunc) Info

func (obj *PrintfFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*PrintfFunc) Init

func (obj *PrintfFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*PrintfFunc) Polymorphisms

func (obj *PrintfFunc) Polymorphisms(partialType *types.Type, partialValues []types.Value) ([]*types.Type, error)

Polymorphisms returns the possible type signature for this function. In this case, since the number of arguments can be infinite, it returns the final precise type if it can be gleamed from the format argument. If it cannot, it is because either the format argument was not known statically, or because it had an invalid format string.

func (*PrintfFunc) Stream

func (obj *PrintfFunc) Stream() error

Stream returns the changing values that this func has over time.

func (*PrintfFunc) Validate

func (obj *PrintfFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL