Skip to content
Anssi Halmeaho edited this page Aug 26, 2024 · 3 revisions

stdrun

Provides services for accessing FunL runtime environment (interpreter).

Procedures

add-to-mod-cache

Adds map as module to module cache in interpreter.

First argument defines symbol name for module (given as string).

Second argument is map from which key-value pairs are used for creating module so that key (string) is to be symbol name in module and value is value for that symbol.

Return value is always true.

Format:

call(stdrun.add-to-mod-cache <module-name:string> <map>) -> true

Example of usage:

ns main

do-something= proc()
	import mymodule

	_ = call(mymodule.say-hello 'Bob')
	_ = call(mymodule.say-bye 'Bob')
	'none'
end

main = proc()
	import stdrun

	mymod = map(
		'say-hello' proc(person) print('Hello ' person ' !') end
		'say-bye'   proc(person) print('Bye Bye ' person) end
	)
	_ = call(stdrun.add-to-mod-cache 'mymodule' mymod)
	call(do-something)
end

endns

Output is:

Hello Bob !
Bye Bye Bob
'none'

backtrace

Returns current function/procedure call chain as list. No arguments are given.

Each item in list is map which consists of:

  • 'file': source file name (string)
  • 'line': line number where func/proc definition starts (int)
  • 'args': list of arguments (list)

Format:

call(stdrun.backtrace) -> list (of maps)
Clone this wiki locally