Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Methods

Irnix treats any executable file inside an object as a method. For example, take object from the previous section and add a file named method:

~/.local/share/irnix
└── object
    └── method

With contents:

#!/bin/python

print("Hello World!")

Which must be made executable:

chmod +x ~/.local/share/irnix/object/method
drwxr-xr-x ~/.local/share/irnix
drwxr-xr-x └── object
.rwxr-xr-x     └── method

Now the method can be invoked with the execute command (or simply e) by passing its name relative to the namespace (here ~/.local/share/irnix):

irnix e object.method

Irnix runs the executable via the system call execve. This means that a method can be either a binary or a script that starts with a shebang (#!). If the file does not start with #! and is not a binary, but you run irnix in bash or zsh, the script will attempt to execute as a Bash script.

In essence this allows all methods of a single object to be written in different programming languages: one in Ruby, another in Python or Bash, and a third could even be a Rust‑compiled binary. This lets you group diverse methods within one object, call them from a single place, and choose the most convenient language for each task while following the UNIX philosophy (“Write programs that do one thing well”).

Passing Arguments

Anything that comes after the separator -- Irnix treats as arguments to be passed to the method during invocation. For example, using the method from the Quick Start chapter:

irnix e object.method -- World!

In this case Irnix will pass all arguments after -- exactly as they were provided.

You can also pass flags, for instance:

irnix e object.method -- --flag value -f value arg1 arg2 --flag2=value

Naming Methods

Method names (files) cannot contain .. They may start with numbers and can include _, - or spaces.

Files should also not have extensions (e.g., .sh or .py). This is due to how Irnix parses a method call. If you try to invoke such a method as object.method.py, Irnix will interpret that method is an object inside the object object, which has a method named py. Irnix simply won’t find such an object and will output an error message. This can be circumvented by creating a link to the file instead. More on using links with Irnix will be covered in the chapter "Working with Links".

Call Details

During a call, Irnix does not analyze the entire object; it only processes the invoked method. For example, when calling object.subobject.method, Irnix will operate solely on the following files (in this example using the default namespace, since the actual path to the method depends on which namespace is specified in environment variables or flags):

  • ~/.local/share/irnix/object/subobject/.self (if it exists)
  • ~/.local/share/irnix/object/subobject/method

This means Irnix performs checks only within the scope of a single call.