Use native source modules
ASPL 0.7.0 · Current release
Check a private-declaration failure, export its helper, and build a complete native module program.
On this page
Prepare the native files
Use the selected native ASPL 0.7.0 toolchain. Follow installation and check/run/build before this guide. The browser cannot load user source modules. Importing a source-looking run file does not change that restriction.
Download both files from the private-declaration example. Put main.aspl and that example's helpers.aspl together in a new directory. For Arabic source, use the supplied الرئيسية.لبات and مساعدات.لبات together in another directory. There are no data assets or standard-library imports. Keep this failed example separate from the corrected example, because both helpers use the same download filename.
Find the private declaration
Run the check from your download directory:
aspl check main.asplIt fails with status 1 and private-member because the entry names lib::answer() while helpers.aspl defines fn answer() privately. Running the same source also fails during checking and produces no program output. An import makes a namespace available; it does not export its members automatically.
Export and retry
In the downloaded helpers.aspl, add share before fn answer:
Illustrative fragment
share fn answer() -> i64 { return 42; }Check and run again. The corrected entry returns 42 with no output, so the shell sees status 42. To inspect it, run aspl run main.aspl followed by echo $?. Exporting a user name does not translate it.
For an independently checked complete correction with output, download both files from source modules into a different directory. This version exports answer, Reply and choose. It keeps hidden private and returns a callable through choose.
Use a returned callable
The corrected complete program prints 42 followed by LF and returns 0. lib::Reply is an exported nominal record, and lib::choose() returns fn(i64) -> i64. Calling that value is valid even though naming lib::hidden directly fails. The private helper's signature uses only public numeric types. A shared signature containing a private record would fail with private-type-exposure.
Build the complete program
From the corrected complete example's directory:
aspl check main.aspl
aspl run main.aspl
aspl build -o module-program main.aspl
./module-programRepeat with the Arabic pair الرئيسية.لبات and مساعدات.لبات in a separate directory. Each root uses its matching helper, with Arabic user names in Arabic source and English user names in English source. You need no input lines or data files. The executable includes the compiled modules and can run without their source files.
Read the full import/export rules and the advanced complete-program collection. The one-file browser course and its beginner quiz do not require source modules.