docs
Built In
Others

Intro

This is a list of other built-ins that we haven't talked about in the documentation.

Globals

filename

A string (not a function): the path of the file you passed to kin run, or the REPL working directory.

Every KIN_INYANDIKO helper resolves relative paths against the directory of filename. Write filename, not filename().

tangaza_amakuru(filename)

ikosa

A mutable global, initially ubusa. It is reserved as an error holder. The runtime does not currently write to it automatically — your program may assign it.

Methods

ubwoko (prefix type operator)

ubwoko is a keyword / prefix operator (tighter than binary operators). It returns a type value, not a string:

  • For primitives and plain objects/arrays/functions: a shared type tag so identity comparisons work (ubwoko 5 == ubwoko 10).
  • For class instances: the class value itself (ubwoko keza == Umuntu).
  • User functions and builtins share one function type value.
  • Parenthesized form ubwoko(x) is still valid.

When printed, type values show names such as number, string, urutonde, fn, class.

Ex:

reka x = 5
tangaza_amakuru(ubwoko x)
tangaza_amakuru(ubwoko [1, 2])
tangaza_amakuru(ubwoko 5 == ubwoko 10)

Prints number, then urutonde, then nibyo.

See also Classes (OOP).

sisitemu()

Runs a host-shell command and returns its trimmed stdout as a string.

Danger: the command runs with your user permissions. Do not paste untrusted text, and do not use examples like sudo shutdown now while learning.

reka out = sisitemu("echo muraho")
tangaza_amakuru(out)

Prints muraho.

Stopping a loop

hagarara is a keyword that breaks out of subiramo_niba. It is not hagarara(0) to stop the Kin process. See Loops.