Skip to content

Coding languages

Hoai Phuoc Truong edited this page Nov 13, 2022 · 3 revisions

Repeat supports several coding languages to create tasks. Tasks written in different languages can easily interact with each other using shared variables.

Switching between programming languages.

Once a task is selected, the main programming language is automatically switched to that task's language.

To manually switch between programming languages, choose Tools --> Compiling languages... in the top right drop down menu.

Manual

Manual is a simple UI driven way to construct a task. Its features are meant to be non comprehensive and limited compared to other programming languages available below. This is most suitable for small tasks that don't require complex logic and special function calls.

Java

Repeat is written in Java, so Java is an easy language to support. There is no external dependencies required to support writing new tasks in this language.

Adding external libraries (JARs)

In Java, it is often convenient that there is an external library that the task wants to call. In order to be able to include external libraries in form of JARs when compiling Java tasks, choose Settings --> Configure compilers... in the top right drop down menu. Note that this only applicable if the current coding language is Java.

Python

Since Python 2 has been deprecated, Repeat only supports Python 3.

Enable support for Python native module

To enable support for Python, follow these steps:

  1. Switch compiling language to Python
  2. Select Settings --> Set compiler path... from the top right drop down menu. This will allow you to specify the Python executable to launch Python. This is basically the executable used to launch your Python program (e.g. $executable main.py). On Linux, this can be found using which python3, which usually returns /usr/bin/python3.
  3. Select Tools --> Native modules... from the top right drop down menu. This will redirect you to a separate page to manage IPC modules.
  4. Choose Python IPC Client row from the table, then click on the "play" button to start the Python native module.

ipc_python

  1. You can now go back to the main page and start writing code.

Adding external libraries

In Python, it is much easier to import an external library as dependency. You can use one of the following ways to import an arbitrary file into the Python program:

  1. my_module = importlib.import_module('os.path') (See this Stackoverflow answer)
  2. sys.path.insert(0, 'path_to_lib_dir') (See this Stackoverflow answer)

C#

Repeat compiles C# code using the same .NET version as the one you have on the system to launch the native C# module with.

Enable support for C# native module

To enable support for C#, follow these steps:

  1. Select Tools --> Native modules... from the top right drop down menu. This will redirect you to a separate page to manage IPC modules.
  2. Choose C# IPC Client row from the table, then click on the "play" button to start the C# native module.

ipc_csharp

  1. You can now go back to the main page and start writing code.