Getting started
Meikaku 1.2.0 is released under the MIT license for macOS (Apple silicon) and Linux (x86_64 and ARM64). Install with Homebrew — this also installs the required [email protected] toolchain automatically:
brew tap asanagi/tap https://git.asanasoft.com/asanagi/homebrew-tap.git
brew install asanagi/tap/meikakuOr download a release tarball directly (requires Zig 0.16 on PATH; building native-window programs on Linux also requires GTK 3 and pkg-config):meikaku-v1.2.0-darwin-arm64.tar.gz (6.1 MB, signed & notarized),meikaku-v1.2.0-linux-x86_64.tar.gz (8.6 MB), ormeikaku-v1.2.0-linux-aarch64.tar.gz (8.7 MB).
A Meikaku program is a set of classes. The compiler, mkc, finds them, checks them, translates them to Zig, and the Zig toolchain builds the native program. In the examples on this page the program starts in the class APPLICATION, by running its creation procedure make. Verify your install by saving and running hello.mei:
class APPLICATION
create
make
feature
make is
do
std_print("Hello, Meikaku\n")
end
endHello, MeikakuRun it with:
mkc hello.mei -rThese command-line options are the ones used for every example on this page:
| Option | What it does |
|---|---|
-r | Build, then run the program. |
-A none | Build without any contract checks (see Contracts). |
-O2 | Build with optimization. |
--build-lib, --lib | Build and use precompiled libraries (see below). |
--uses json,db | List packages for a single-file run that has no meikaku.json (see Packages and uses). |
mkc install <path>, mkc list | Register a package for your user account, or list the packages the compiler knows. |
You can also point mkc at a whole directory. It finds every class in it, and the folder layout becomes the namespaces: nissan/car.mei defines nissan.Car. Where to put the compiler's temporary files is set by MEIKAKU_TMPDIR.
Classes and files
- A class is introduced with
class NAME. Its creation procedures followcreate, and its routines and attributes sit underfeature. - A
noteclause before a class says in plain words what it is for. The standard library usesdescription:andauthor:. - Comments start with
--. A routine body isdo ... end, andisfollows the signature. - There are no import statements. The compiler finds classes in your project's files and in the packages your
meikaku.jsonlists underuses(see Packages and uses). - One class model: there is no separate interface or trait. A routine with no
dobody, markeddeferred, is the contract a descendant must fill in.
Older spellings are rejected with a message that says what to use instead. Section keywords take no colons (create, not create:), comments are --, not //, and the keyword is inherit, not inherits.
Packages and uses
Since version 1.2, everything beyond the core comes in a package, and a project says which packages it uses. The standard library groups (json, db, net, ui and so on), your own libraries and native drivers are all packages. Only base, collections,io and time are always available.
{
"name": "app",
"version": "0.1.0",
"root": "APPLICATION.make",
"uses": ["json"]
}A class from a package you did not list is simply not found. There is no hint and no automatic loading, so the manifest is the whole truth about what a project depends on:
class APPLICATION
create
make
feature
make is
local
j: JSON_VALUE
do
std_print("hi\n")
end
endSemantic error in module '': Unknown class/type 'JSON_VALUE'
Semantic Analysis failed: UnknownParentClassVisibility is not transitive: if your project uses web and web itself usesjson, your own code still has to list json to name its classes. For a single file with no manifest, pass the packages on the command line:
mkc app.mei -r --uses json,dbYour own packages and native drivers
A package is a folder with a meikaku.json of its own. A source package holds .mei files; a native package holds a Zig bridge, as the AsanagiDB driver does. A project points at one underpackages and lists it under uses:
{
"name": "tool",
"version": "0.1.0",
"root": "APPLICATION.make",
"uses": ["db", "asanagidb"],
"packages": {
"asanagidb": { "path": "../asanagidb-document", "kind": "native" }
}
}mkc install <folder> registers a package for your user account, in~/.meikaku/packages.json, so projects can list it without a path. mkc list shows what the compiler knows: the system packages that ship with it, then yours. The compiler looks for a package in the project first, then in your user list, then in the system list.
mkc listSystem packages:
base (source, implicit) -> .../lib/base
collections (source, implicit) -> .../lib/collections
io (source, implicit) -> .../lib/io
time (source, implicit) -> .../lib/time
concurrency (source) -> .../lib/concurrency
...
User packages:
(none)Moving a project from 1.1
- The
librariesanddriverskeys are rejected with a message that names the replacement. Move each entry intopackagesand add its name touses. - Add every standard library group the project touches to
uses. Compile; each missing one shows up as Unknown class/type. - Standard library groups no longer load on their own, so a project that never listed them must now do so.
Types and equality
INTorINTEGERis a 64-bit signed integer,REALa 64-bit float,BOOLEANa truth value,CHARACTERan 8-bit character, andSTRINGtext.STRINGis an expanded class: it is a plain value, so=compares its content.:=assigns.=tests equality and/=tests inequality. Writing==as equality is rejected.~and/~compare objects by their contents, throughis_equal, while=on two objects asks whether they are the very same one.- A function's result is the predefined name
Result. - A reference that may be empty is declared
detachable, andattached x as ychecks it before use. The empty value isVoid. - Strings join with
.concat(...)or+, and numbers print with.to_string.
Contracts
Contracts are the heart of Meikaku. They are written in the language, tagged with names, and evaluated while the program runs.
| Keyword | Meaning | If it fails |
|---|---|---|
require | What must be true when the routine is called. | The caller is blamed (client blame). |
ensure | What is true when it returns. old x is the value of x on entry. | The routine is blamed (supplier blame). |
invariant | What is true of every object of the class, at all times between calls. | The routine is blamed (supplier blame). |
A failure reports the class, the routine, the tag, and who is to blame. A precondition failure is raised in the caller's own code, so the caller can handle it. The routine's body never runs.
An invariant is checked when an object is created
class APPLICATION
create
make
feature
make is
local
acc: ACCOUNT
do
std_print("Attempting invalid creation procedure...\n")
create acc.make(-100)
std_print("Creation procedure completed\n")
end
end
class ACCOUNT
create
make
feature
balance: INT
make(initial_balance: INT) is
do
balance := initial_balance
std_print("make body finished\n")
end
invariant
positive_balance: balance >= 0
endAttempting invalid creation procedure...
make body finished
panic: Contract violation: class 'ACCOUNT', feature 'class_invariant', tag 'positive_balance' [supplier blame]Inside a class, calling one of its own routines directly does not re-check the invariant, so a multi-step algorithm may pass through states that are briefly inconsistent. Calls made through an object, such asother.deposit(5), do check it.
Contracts and inheritance
A descendant may accept more than its ancestor, never less. When it redefines a routine, a new precondition is written require else and is combined with the ancestor's by or. A new postcondition is written ensure then and is combined by and.
class BASE
feature
process(x: INT) is
require
base_req: x = 1000
do
std_print("base process\n")
end
end
class HEIR
inherit
BASE
redefine process end
feature
process(x: INT) is
require else
r1: x > 10
r2: x < 20
do
std_print("heir process\n")
end
endCalling process(5)...
panic: Contract violation: class 'HEIR', feature 'process', tag 'base_req, r1' [client blame]class PARENT
feature
compute(x: INT): INT is
do
Result := x
ensure
pos_res: Result > 0
end
end
class HEIR
inherit
PARENT
redefine compute end
feature
compute(x: INT): INT is
do
Result := x
ensure then
small_res: Result < 10
end
endCalling compute(15)...
panic: Contract violation: class 'HEIR', feature 'compute', tag 'small_res' [supplier blame]Contracts are a build-time choice
Contracts must only look at state, never change it. That is what makes it safe to remove them. Building with-A none leaves no checks in the program, and a correct program does the same thing without them.
-- Built with: mkc stripping.mei -r -A none -O2
class APPLICATION
create
make
feature
make is
do
test_contract(5)
end
test_contract(x: INT) is
require
must_be_greater_than_10: x > 10
do
std_print("Completed successfully without contract checks\n")
end
endCompleted successfully without contract checksInheritance
inheritnames the parents. A class may have several.redefinereplaces an inherited routine. Doing it by accident, without saying so, is a compile error.- If two parents both supply the same routine, the heir must settle it with
redefineorselect. The compiler never resolves a clash silently. - There is no
renameand nosuper. To reach a parent's version, call it by the parent's name, as inSHAPE.area. - Giving a body to a
deferredroutine does not needredefine. - A
frozen classcannot be inherited from.
class APPLICATION
create
make
feature
make is
local
w: WIDGET
r: RENDERABLE
e: EVENT_HANDLER
do
create w.make
r := w
e := w
std_print("Call via RENDERABLE view:\n")
r.render
std_print("Call via EVENT_HANDLER view:\n")
e.handle_event("click")
std_print("Call via WIDGET direct:\n")
w.render
end
end
class RENDERABLE
feature
render is
do
std_print("RENDERABLE.render\n")
end
end
class EVENT_HANDLER
feature
handle_event(evt: STRING) is
do
std_print("EVENT_HANDLER.handle_event: ".concat(evt).concat("\n"))
end
end
class WIDGET
inherit
RENDERABLE
redefine render select render end
EVENT_HANDLER
redefine handle_event end
create
make
feature
make is do end
render is
do
std_print("WIDGET.render\n")
end
handle_event(evt: STRING) is
do
std_print("WIDGET.handle_event: ".concat(evt).concat("\n"))
end
endCall via RENDERABLE view:
WIDGET.render
Call via EVENT_HANDLER view:
WIDGET.handle_event: click
Call via WIDGET direct:
WIDGET.renderdeferred class PAINTER
feature
paint_cost: INT is deferred end
total_cost(n: INT): INT is
require
positive: n > 0
do
Result := paint_cost * n
ensure
not_negative: Result >= 0
end
end
class ROLLER
inherit
PAINTER
feature
paint_cost: INT is
do
Result := 7
end
end
class APPLICATION
create
make
feature
make is
local
p: ROLLER
do
create p
std_print("Cost for 3: ".concat(p.total_cost(3).to_string).concat("\n"))
end
endCost for 3: 21Visibility and uniform access
A client cannot tell an attribute from a routine that computes the same thing: both are read the same way, ass.area or s.scale. In version 1.1.0 this rule became strict: a feature that takes no arguments is written with no parentheses.
class SHAPE
create
make
is
feature
make is
do
scale := 1
end
scale: INTEGER = 1
area: INTEGER is
do
Result := base_area * scale
end
describe_twice: INTEGER is
do
Result := area + area
end
base_area: INTEGER is
do
Result := 10
end
feature { NONE }
helper_bonus: INTEGER is
do
Result := 5
end
with_bonus: INTEGER is
do
Result := area + helper_bonus
end
end- Attributes are read-only outside their class. A client reads
s.scalebut cannot assign to it. - A
feature { NONE }section is private to the class.
class MAIN
create
make
is
feature
make is
local
s: SHAPE
do
create s.make
s.scale := 5
std_print (s.scale.to_string)
end
endSemantic error in class 'MAIN': Cannot assign to attribute 'scale' of class 'SHAPE' from a client; attributes are read-only outside their class. make is
local
s: SHAPE
do
create s.make
std_print (s.area().to_string)
endSemantic error in class 'MAIN': Feature 'area' takes no arguments; write 's.area', not 's.area()'.Control flow and errors
Loops
A loop has an initialization, an exit test, and optionally an invariant that must hold on every pass and a variant, a number that shrinks on every pass, showing that the loop will end.
class APPLICATION
create
make
feature
make is
local
i: INT
do
from
i := 0
until
i >= 3
invariant
non_negative: i >= 0
variant
3 - i
loop
std_print("i = ".concat(i.to_string).concat("\n"))
i := i + 1
end
end
endi = 0
i = 1
i = 2Once routines
A once routine runs its body on the first call and returns the same result every time after.
class APPLICATION
create
make
feature
make is
local
cfg1: CONFIG
cfg2: CONFIG
do
cfg1 := global_config
std_print("First access: host = ".concat(cfg1.host).concat(", port = ").concat(cfg1.port.to_string).concat("\n"))
cfg2 := global_config
std_print("Second access: host = ".concat(cfg2.host).concat(", port = ").concat(cfg2.port.to_string).concat("\n"))
end
global_config: CONFIG is
once
std_print("Initializing once CONFIG instance...\n")
Result := create CONFIG.make("localhost", 8182)
end
end
class CONFIG
create
make
feature
host: STRING
port: INT
make(a_host: STRING, a_port: INT) is
do
host := a_host
port := a_port
end
endInitializing once CONFIG instance...
First access: host = localhost, port = 8182
Second access: host = localhost, port = 8182Rescue and retry
A rescue clause handles an exception raised in the routine. retry runs the routine again from the top. Exceptions are raised with the library, as{DEVELOPER_EXCEPTION}.raise(...), and the plain raise statement is rejected.
class PORT_CLIENT
create
make
feature
attempts: INT
make is
do
attempts := 0
end
connect(host: STRING, port: INT): BOOLEAN is
do
attempts := attempts + 1
std_print("Connecting to ".concat(host).concat(":").concat(port.to_string).concat(" (attempt ").concat(attempts.to_string).concat(")...\n"))
if attempts < 3 then
{DEVELOPER_EXCEPTION}.raise("Connection refused on port ".concat(port.to_string))
end
Result := true
rescue
std_print("Caught error in rescue block\n")
if attempts < 3 then
std_print("Retrying connection...\n")
retry
else
std_print("Max attempts reached, returning false cleanly\n")
Result := false
end
end
endConnecting to 127.0.0.1:9999 (attempt 1)...
Caught error in rescue block
Retrying connection...
Connecting to 127.0.0.1:9999 (attempt 2)...
Caught error in rescue block
Retrying connection...
Connecting to 127.0.0.1:9999 (attempt 3)...
Connection succeeded after retriesGenerics
A class can take a type parameter, written in square brackets. The standard collections work the same way, for example ARRAYED_LIST[NODE] and HASH_TABLE[STRING, NODE].
class CELL[G]
create
make
feature
item: G
make(initial: G) is
do
item := initial
end
end
class APPLICATION
create
make
feature
make is
local
numbers: CELL[INT]
words: CELL[STRING]
do
create numbers.make(42)
create words.make("Meikaku")
std_print("Number: ".concat(numbers.item.to_string).concat("\n"))
std_print("Word: ".concat(words.item).concat("\n"))
end
endNumber: 42
Word: MeikakuA class of your own with the same name as a library class, such as BOX, takes its place in your project. The core kernel classes (for example STRING and INTEGER) cannot be redefined: the compiler stops with Cannot redefine standard kernel class.
Zig and C interop
A routine can have a native body written in Zig. It keeps its contract, so the promise around the Zig code is still checked. In the current compiler the Zig code sets the variable result and then returns it.
class APPLICATION
create
make
feature
make is
do
std_print("sqrt(16.0) = ".concat(root_of(16.0).to_string).concat("\n"))
end
root_of(val: REAL): REAL is
require
non_negative: val >= 0.0
native
const res = std.math.sqrt(val);
result = res;
return res;
ensure
non_negative_result: Result >= 0.0
end
endsqrt(16.0) = 4.0000The standard library uses the same door to reach C libraries. For example, LIBUI is a direct binding to the libui-ng C API, and SQLITE_DB is built on C interop.
Solutions and libraries
Meikaku ships with a batteries-included standard library for building services, CLI tools, data pipelines, and native desktop or terminal apps—and compiles to Zig so you can wrap existing C and Zig libraries behind checked contracts.
Web & Networking
Build HTTP/HTTPS clients, status APIs, web apps with routing and sessions, raw TCP/TLS sockets, and TLS certificate probes.
Databases & Storage
Talk directly to AsanagiDB (Compository documents + Gremlin), SQLite, PostgreSQL, and Redis.
Desktop & Terminal UIs
Ship native macOS/Linux windows via libui-ng, ANSI terminal apps, and 2D graph layouts with contract-checked widget lifecycles.
Systems, Concurrency & Security
Channels, mutexes, worker pools, filesystem and subprocess APIs, plus AES-256-GCM and SHA/HMAC primitives.
Leveraging external C, Zig, and precompiled libraries
- External C libraries: Because
mkccompiles through Zig, any C library with headers can be called from anativeroutine via Zig’s C interop (@cImport) and wrapped in a Meikaku class whoserequire,ensure, andinvariantclauses guard every boundary. This is how the standard library itself wrapslibui-ng,sqlite3, andOpenSSL(see Zig and C interop). - Direct Zig code: Drop into a
nativeblock whenever you need low-level systems access, OS APIs, or hot-loop tuning while keeping Meikaku’s contract checks around the routine. - Reusable Meikaku bundles (
.meilib): Compile a cluster of Meikaku classes once into a precompiled library and link it into other programs with contracts and cross-library inheritance intact (see Precompiled libraries).
Standard library
Each group below is a package. Only base, collections, io and timeare always available; list any other group under uses (see Packages and uses). The descriptions below come from each class's own note clause. A check mark means the compiler's conformance suite has cases that use the class. A dash means the class is part of the library but has no conformance case of its own yet.
Basics
| Class | What it is | Tested |
|---|---|---|
INTEGER | Expanded 64-bit signed integer. | — |
REAL | Expanded 64-bit floating-point number. | — |
BOOLEAN | Expanded truth value. | — |
CHARACTER | Expanded 8-bit character. | — |
STRING | Expanded text class. | — |
MATH | Mathematical functions and constants. | ✓ |
BASE64 | Base64 encoder and decoder. | ✓ |
EXCEPTION | Ancestor of all exception types. | — |
DEVELOPER_EXCEPTION | User and developer raised exceptions. | — |
PROCEDURE, FUNCTION | Agents: a procedure, or a function returning a value. | — |
Collections
| Class | What it is | Tested |
|---|---|---|
ARRAY, ARRAYED_LIST, LIST, SORTED_LIST, HASH_MAP, HASH_TABLE, SET, STACK, QUEUE | Generic containers. ARRAYED_LIST and HASH_TABLE are used in the conformance suite’s generics case. | — |
Concurrency
| Class | What it is | Tested |
|---|---|---|
CHANNEL | Synchronized FIFO message channel for tasks to talk to each other. | — |
MUTEX | Low-level mutual exclusion lock. | — |
WORKER_POOL | Multi-threaded worker pool for parallel tasks. | — |
Data
| Class | What it is | Tested |
|---|---|---|
DATA_FRAME, SERIES | In-memory two-dimensional tabular data engine. | — |
JSON
| Class | What it is | Tested |
|---|---|---|
JSON_VALUE | A JSON value: null, boolean, number, string, array or object (RFC 8259). | ✓ |
JSON_PARSER, JSON_PARSE_RESULT | Parser producing a JSON_VALUE tree, and the outcome of a parse. | ✓ |
JSON | Older formatting and extraction helper, kept for compatibility. | ✓ |
Files and system
| Class | What it is | Tested |
|---|---|---|
FILE, DIRECTORY, PATH | On-disk files, directories and paths. | — |
ENVIRONMENT | Environment variables, system paths and command-line arguments. | ✓ |
PROCESS | Run system processes and control exit. | — |
TIME | Time, clock and delay utilities. | ✓ |
Networking
| Class | What it is | Tested |
|---|---|---|
HTTP_CLIENT | HTTP and HTTPS client with redirects, timeouts, and dual-stack IPv4 and IPv6. | ✓ |
HTTP_OPTIONS, HTTP_RESPONSE | Request options, and the captured status, headers and body. | ✓ |
HTTP_SERVER | Native HTTP server for web applications and status APIs. | ✓ |
TCP_SOCKET, TLS_SOCKET | TCP sockets, and TLS over them using OpenSSL. | — |
TLS_PROBE, TLS_CERT_INFO | Inspect a peer’s TLS certificate and its expiry. | ✓ |
WEB_APP, WEB_ROUTER, WEB_REQUEST, WEB_RESPONSE, WEB_SESSION | A small web framework: routes with parameters (/users/:id), middleware, cookies and sessions. | — |
Databases
| Class | What it is | Tested |
|---|---|---|
ASANAGI_DB, ASANAGI_DB_TCP, ASANAGI_DB_WS | AsanagiDB clients: document-style CRUD and Gremlin traversals, over JSON-line TCP or the binary ASNA protocol. | ✓ |
VERTEX_INFO, EDGE_INFO | Decoded vertex and edge data from AsanagiDB. | ✓ |
SQLITE_DB, SQLITE_QUERY | Native SQLite client and a fluent query builder. | — |
PG_ROW | PostgreSQL client and query result driver. | — |
REDIS_CLIENT | Redis key-value and publish/subscribe client. | — |
Security
| Class | What it is | Tested |
|---|---|---|
AES_CIPHER | AES-256-GCM encryption and decryption. | — |
CRYPTO_HASH | SHA-256, SHA-512, MD5 and HMAC-SHA256. | — |
Graph layout
| Class | What it is | Tested |
|---|---|---|
GRAPH_NODE, GRAPH_EDGE | Nodes and edges of a 2D graph layout. | — |
RADIAL_LAYOUT | Selected vertex in the centre, direct neighbours on a circle. | ✓ |
GRAPH_HIT_TEST | Hit-testing for node selection on a canvas. | ✓ |
NAV_HISTORY | Back and Forward over selected vertices. | ✓ |
RESULT_CAPPER | Result capping and pagination, with contract checks. | ✓ |
Native UI (libui-ng)
| Class | What it is | Tested |
|---|---|---|
WINDOW, BOX, GRID, TAB, LABEL, BUTTON, ENTRY, MULTILINE_ENTRY, COMBOBOX, LIST_WIDGET, CANVAS, CANVAS_PAINTER, MENU | Native windows and controls. The base class CONTROL carries contracts against use-after-destroy and against giving a control two parents. | ✓ |
Terminal UI
| Class | What it is | Tested |
|---|---|---|
TUI_APP, TUI_WIDGET | Terminal application engine with ANSI rendering, and a base widget. | — |
Two small examples
class APPLICATION
create
make
feature
make is
local
b64: BASE64
original: STRING
encoded: STRING
decoded: STRING
do
create b64
original := "Hello Meikaku"
encoded := b64.encode(original)
decoded := b64.decode(encoded)
std_print("Encoded base64: ".concat(encoded).concat("\n"))
std_print("Decoded base64: ".concat(decoded).concat("\n"))
std_print("Roundtrip match: ".concat((original = decoded).to_string).concat("\n"))
end
endEncoded base64: SGVsbG8gTWVpa2FrdQ==
Decoded base64: Hello Meikaku
Roundtrip match: true-- excerpt: the body of make, with its local declarations omitted
create json_obj.make_object
json_obj.put_string("service", "watchtower")
json_obj.put_integer("port", 9090)
json_obj.put_boolean("enabled", true)
json_obj.put_null("optional")
create arr.make_array
arr.add_string("alpha")
arr.add_string("beta")
arr.add_integer(42)
json_obj.put("tags", arr)
ser := json_obj.to_json
std_print("Serialized: " + ser + "\n")
create parser.make
res := parser.parse(ser)
std_print("Parse valid: " + res.is_valid.to_string + "\n")
if res.is_valid and then attached res.value as v then
std_print("Service: " + v.get_string("service", "") + "\n")
std_print("Port: " + v.get_integer("port", 0).to_string + "\n")
endSerialized: {"service":"watchtower","port":9090,"enabled":true,"optional":null,"tags":["alpha","beta",42]}
Parse valid: true
Service: watchtower
Port: 9090Precompiled libraries
New in 1.1.0. A set of classes can be compiled once into a library bundle and used by other programs without its source. Contracts travel with it, and a program can inherit from, and redefine routines of, a library class.
# Build the SHAPE library once...
mkc --build-lib shapes/ -o shapes.meilib
# ...then compile a program against it.
mkc app.mei -r --lib shapes=shapes.meilibIn this example the library holds the SHAPE class shown above. A consumer redefinesarea and reaches the library's own version with SHAPE.area. Library code that callsarea picks up the redefinition: describe_twice is the library's, and it returns twice the new value.
class APP is
feature
run is
local
s: PLUS_SHAPE
do
create s.make
std_print(s.area.to_string)
std_print(s.describe_twice.to_string)
end
end
class PLUS_SHAPE
create
make
inherit
SHAPE
redefine area end
is
feature
area: INTEGER is
do
Result := SHAPE.area + 1
end
end1122The rules that apply across the library boundary are the same ones that apply inside one program: attributes are read-only, private features stay private, and a frozen class in a library cannot be inherited from.
Tooling
mkc-lspis a language server, shipped with the compiler.- Editor support for Sublime Text, VS Code and Zed is kept in the compiler's repository.
- The compiler has a
doccommand that generates reference pages for classes.
Differences from Eiffel
Meikaku is deliberately a subset of Eiffel in spirit: a Meikaku class should look familiar to an Eiffel programmer, but a valid Eiffel class is not always a valid Meikaku class. If you are learning fromEiffel: The Language or the Eiffel documentation, this table lists where Meikaku does something different. Each row was checked against the 1.2.0 compiler. Anything not listed here has not been checked, so treat the Eiffel book as a guide and let the compiler have the final say.
| Topic | In Eiffel | In Meikaku |
|---|---|---|
| Boolean literals | True, False | true, false in lower case. True is rejected. |
and, or | Evaluate both sides. and then and or else stop early. | All four stop early. a and b means the same as a and then b, so the right side is skipped when the left side decides the answer. |
| Division | / is real division, // is integer division, \\ is the remainder. | / divides: two integers give an integer result, and reals give a real result. // and \\ are not operators; // is reported as a comment error. |
| String equality | STRING is a reference type, so s1 = s2 compares identity. Use ~ for content. | STRING is an expanded class (a plain value), so s1 = s2 compares content. ~ also works. |
| Renaming | rename in an inherit clause. | No rename. redefine and select are supported, and feature names stay the same through the hierarchy. |
| Calling the parent version | Precursor | No Precursor and no super. Call the parent's version by the parent's name, as in SHAPE.area. |
| Zero-argument calls | No parentheses. | No parentheses, and the compiler enforces it. This is a change from versions before 1.2. Inside native … end blocks the text is raw Zig, so Zig's parentheses are required there. |
| Rejected C-style forms | Not part of the language. | != (use /=), == (use =), // comments (use --), inherits (use inherit), and a colon after section headers such as create and feature all produce a clear error. |
| Projects and libraries | An ECF configuration file with clusters and libraries. | A meikaku.json manifest with uses and packages. See Packages and uses. |
| Foreign code | External routines in C and C++. | Raw Zig in native … end blocks, and C or Zig through native packages. See Zig and C interop. |
The parts that match Eiffel: := for assignment, = and /= for equality,~ and /~ for object equality, Result as the function result, contracts (require, ensure, invariant), create procedures, deferred and expanded classes, and generics.
Known limits
- Release packages target macOS on Apple silicon and Linux on x86_64 and ARM64 (aarch64). There is no Intel Mac or Windows package yet.
- Building programs with a native window on Linux needs GTK 3 and pkg-config.
- Syntax changed in version 1.0 to match Eiffel. Code written for older versions needs updating. Version 1.2 also removed the
librariesanddriverskeys: see Packages and uses for the migration. - A class that inherits from a deferred class cannot be passed straight as an argument to a parameter of the deferred type, and
ARRAYED_LISTof a deferred class does not compile. Assign to a variable of the deferred type first, or use a concrete wrapper class. - Some standard library classes have no conformance case yet; they are marked in the tables above.
Questions, or something you would like to build? Write to[email protected].
