The EK9 IDE
The EK9 IDE is a desktop editor for EK9 with the compiler built in. You start it with ek9 -ide.
ek9 -ide
What you need
ek9 -ide starts the IDE. Like the rest of EK9, it needs Java 25 or later.
A first program
Your first project makes a new project and runs a program in it, step by step, with a picture of
each step. To open a directory of .ek9 files you already have, use File > Open Project…, open a source file, and
run its program with Run > Run Program…. Here is the program from the introduction:
#!ek9 defines module site.introduction.hello defines program HelloWorld() stdout <- Stdout() stdout.println("Hello, World")
Download introduction_hello.ek9
The editor indents with two spaces: Tab inserts two spaces and Shift+Tab outdents.
The lessons
The IDE teaches itself in lessons: each one shows you an action step by step, then watches while you do it. Each
lesson has a page of its own here, with every step and a picture of the IDE once it is done. To play one in the IDE,
choose Help > Lessons and its group, or run ek9 -ide -lesson <name>.
Getting started
Your first project, and finding your way round the IDE.
- Your first project: A new project, a new file, the example program pasted in from the answers, and run.
- Chapter 6: reading errors: Where an error shows - the Problems tab and the margin - the Tab quick fix for a misspelt name, Next Error (F2) through the errors the compiler finds next, the error-detail slider (E0 to E3) and /h and an error's code for its full explanation.
- The panels: The bottom panel and its panes (View > Bottom Panes), the tool windows beside the editor (View > Tool Windows), tearing a pane off into a window of its own and bringing it back (Window > Redock All), and the view switches in View > Toggles.
- Asking the IDE: The input bar at the top: /h for a type or keyword, /q for a question, /t for a tool - each answered in its own tab (Help, Answers, Tooling) - and the Hovers panel, which explains whatever the pointer rests on.
- Help and documentation: What the Help menu holds - EK9 Paradigm, Licences, every lesson, the documentation - and Go to Line (Cmd+L), the navigation no other lesson plays.
Finding
Search and replace, in Text or Symbols mode, across one file, a module or the whole project - and the two other ways of finding your way, Find Construct and Find References.
- Find: text: Type into the find bar and watch the count update live, step through matches with Find Next/Previous, then narrow with Match case (Aa) and Whole word (W) - Text mode searches the file itself, comments and Strings included.
- Find: regex replace: The replace row, a regular expression with a capture group reordered in the replacement, and Replace All - in Text mode, so the file is saved once the change is made.
- Find: symbols: Symbols mode asks the last compile, never the text - a name in a comment or a String never matches - classified by the three kind chips (Constructs, Members, Variables), each with its own dropdown, and narrowed by whether a place is declared, read or written.
- Replace: symbols: Replace in Symbols mode renames the whole symbol through ek9_rename_symbol - a compile-checked preview, one atomic change across every place it is used - never a raw text edit.
- Find in Project: The File / Module / Project scope, Edit > Find in Project…, the List button bringing the Find Results tab forward again, and jumping from a result straight into its file.
- Find your way: Find Construct… jumps to a class, function or program by name, anywhere in the project; Find References jumps the other way, from a symbol to every place it is used.
Writing code
New constructs - classes, functions, records - and the fields, methods and operators they hold.
- New Construct: the dialogs: What the New Construct dialogs ask for: a class made Open, a class that Extends it, a trait (which has neither choice), Preview before Apply, and Code > New Package… for a package block.
- Adding members to a class: The right-click menu on a class's name line: Add Field…, Add Constructor ▸ From All Fields, Add Method…, Add Operator ▸ with its skeleton, and Collapse to 'default operator' - the explicit operator folded back to what the compiler would generate.
- Create Dynamic Function: Author a closure - a local variable holding a small function, extending a base you pick - after the caret, with no construct of its own to name.
- Create Dynamic Class: Author an inline class - implementing one or more traits, extending a generic base, or naming a module-level tuple type - after the caret, with no construct of its own to name.
- Your own generic class and function: Write a generic class and a generic function, not just use List: New Construct ▸ Class… with Generic ticked - a type parameter T constrained by a trait, and the field that holds a T - Add Method, a generic Function…, then a program that fills the one Shelf with two different types; Effective API and Type Hierarchy read each filling.
Applications and services
Applications and dependency injection, aspects, web services and networking - each built with the IDE's tools, then run.
- An application and its test double: Build dependency injection with the IDE's tools: an abstract Notifier component, a production and a test implementation, two Applications that register them - the same construct is production wiring and test substitution, there is no mocking framework - a program bound to one that injects the component with the ! suffix, and a @Test bound to the other. DI Wiring shows the application healthy, the program runs, and the Tests tab shows the test pass.
- An aspect around a component: Build an aspect with the IDE's tools: a class extending Aspect with before and after advice, an Application whose registration names it in the new With Aspect column, and a program that calls the component - the run shows the advice around the call, and the caller never knew. No annotations, no proxy to configure.
- A web service, built and served: Build a small web service with the IDE's own tools - New Construct > Service… for the service and a first route, then Add Route… for a second route that takes a path parameter - read both in the Service Routes window, register the service in an application and write the program that serves it on localhost only. Run it under the debugger, ask both routes for their answers from the IDE's Terminal with curl, and Stop the server.
- A TCP echo on localhost: Build a server program and a client program that talk over TCP on localhost, one fixed port - the network types are gated, so the package must declare them: E12010 shows first and the Add capability quick fix puts it right. Then save a run configuration for each program, run the server, run the client, and read both outputs; the client's last word stops the server.
Getting Started with EK9
The book's examples, chapter by chapter, each built with the IDE's own tools - typing only the logic no tool can write.
- Chapter 1: a second greeting, typed: Build the book's Greeting program: New Construct ▸ Program… writes the shell and the two print lines are typed. Then run it.
- Chapter 2: values, reshaped: Build the book's Values program with New Construct, type a plainer draft first - a stray local that only gets in the way, two expressions written straight into their println calls - then use Inline Variable to remove the stray local and Extract Variable, twice, to give each expression the name the book prints it by.
- Chapter 2: escapes in a string, typed: Build the book's Escapes program: New Construct ▸ Program… writes the shell, and the body - a new line, a tab and \u escapes beside the same characters typed directly - is typed. Then run it.
- Chapter 2: changing a value, typed: Build the book's smallest program: New Construct ▸ Program… writes the shell, and the three lines that declare a value, change it and change it again from its own old value are typed. Then run it.
- Chapter 2: declaring and changing values, typed: Build the book's Declarations program: New Construct ▸ Program… writes the shell, and the body - every way to declare a value, an unset one, three ways to reassign and assign-if-unset - is typed, because no tool writes a declaration for you. Then run it.
- Chapter 3: a three-way test, folded: Build the book's Weather program with New Construct ▸ Program… (its parameter in the same dialog), write the prints plain, and let Surround With ▸ if and ▸ if … else fold them under their tests - typing the conditions and the else if / else tail the second template leaves as a placeholder.
- Chapter 3: a switch, folded: Build the book's DayKind program with New Construct ▸ Program… (its parameter in the same dialog), write the Weekday print plain, and let Surround With ▸ switch fold it into a switch with a default - typing the subject, the case values and the other branches over its placeholders.
- Chapter 3: a switch of comparisons, folded: Build the book's Grade program the same way - the Fail print and the three marks written plain, then Surround With ▸ switch - typing the comparisons ('case < passMark') and the other branches.
- Chapter 3: three loops, folded: Build the book's Counting program: three prints that name a loop counter i, each wrapped by Surround With ▸ for range - whose head already names i - and its range typed: up by one, up by two, down by two.
- Chapter 3: a loop, reshaped: Build the book's Countdown program with New Construct, type its plain straight-line version first, then use Surround With to fold the repeating part under a while head and replace its placeholder with the real test.
- Chapter 3: do ... while, typed: Build the book's Countup program: New Construct ▸ Program… writes the shell (its parameter in the same dialog) and the do ... while loop is typed - Surround With has no do ... while. Then run it.
- Chapter 4: three pure functions, built: Build the book's square, add and sumOfSquares functions and their Demo program with the IDE's own tools - New Construct ▸ Function… (parameters, return and pure in the dialog) and ▸ Program… - typing the answers and the comments no tool can write.
- Chapter 4: a return settled by an if, built: Build the book's describe function: New Construct ▸ Function… writes the signature, the return is typed as an empty String, and Surround With ▸ if ... else folds the first assignment under an if whose else is typed - then a Show program runs it.
- Chapter 4: a function, built: Build the book's announce function and its program with New Construct - typing only the logic no tool can write, and the short line explaining why the function returns nothing.
- Chapter 4: a precondition, built: Build the book's halve function - a pure function whose require n? is checked first - and its Demo program with New Construct ▸ Function… and ▸ Program…, typing the return's name and the work.
- Chapter 4: a precondition that fails, built: Build the book's deliberate bug: halve, with its precondition, and a program that hands it an unset Integer - it compiles, and the run stops at the require.
- Chapter 5: tests, built: Build the book's square/cube functions and the @Test programs that check them with the IDE's own tools - New Construct ▸ Function… and ▸ Test…, typing only the logic no tool can write - then Run Tests, read the Tests tab and its coverage shading, and try Generate Edge-Case Tests.
- Chapter 7: money, typed: Build the book's Receipt program: New Construct ▸ Program… writes the shell and the prices, quantities and totals - Money in pounds - are typed. Then run it.
- Chapter 7: dates, typed: Build the book's Deadline program: New Construct ▸ Program… writes the shell and the date, duration and formatting lines are typed. Then run it.
- Chapter 7: asking about a type: Build the book's Measures program with the IDE's own tools - New Construct ▸ Program… - then ask the IDE what a Dimension is two ways before it runs: /h Dimension in the input bar, and Analyse ▸ Effective API with the caret on width.
- Chapter 7: constants, built: Build the book's Constants: New Construct ▸ Constant… writes each of four module-level constants - an Integer, a String, a Money and a Time - from its literal, and the program that prints them is typed.
- Chapter 7: a constant that is copied, built: Build the book's ConstantCopy: a constant, a function that changes its own parameter, and a program that passes both a variable and the constant to it - with New Construct ▸ Constant…, ▸ Function… and ▸ Program…, typing the bodies.
- Chapter 8: greeting in three languages, built: Build the book's Greetings program with the IDE's own tools - New Construct ▸ Program…, then Extract to Localized Text… on a hard-coded English greeting, which creates the Greeting text type in one call, then Add Locale… (twice) - typing only the wording and the two further greetings no tool can write.
- Chapter 8: choosing a language, built: Build the book's Greet program with the IDE's own tools - New Construct ▸ Program… with its one CLI parameter, Extract to Localized Text… on a hard-coded greeting, Add Locale… (twice) - typing only the wording and the choice of language, which falls back to English when no text type speaks it.
- Chapter 8: a language from the environment, built: Build the book's EnvGreet program with the IDE's own tools, then run it twice from Run ▸ Configurations…: with APP_LANG unset it greets in English, with APP_LANG=fr in French. Only the wording and the environment lookup are typed.
- Chapter 8: a price and a date, localised: Build the book's Order program with the IDE's own tools - New Construct ▸ Program…, Extract to Localized Text… (whose Money and Date parameters it infers from the sentence), Add Locale… (twice) - typing only the sentences, which ask the locale to write the total and the date its own way.
- Chapter 8: a text type, built: Build the book's Party text type and Show program with the IDE's own tools - New Construct ▸ Program…, then Extract to Localized Text… on a hard-coded greeting, which creates Party in one call (its own new-type fields) and renames the inferred parameter (its own Parameters table), then Add Locale… (twice) - typing only the wording no tool can write: English first, the parameter's real name, then French and German.
- Chapter 9: collections, asked about: Build the book's Basket program with the IDE's own tools - New Construct ▸ Program… - then ask the IDE about collections two ways before it runs: /q 129 in the input bar, over the Dict's own getOrDefault, and Analyse ▸ Effective API, read once on a List and once on a Dict.
- Chapter 9: a list, a dict and JSON: Build the book's Collections program with the IDE's own tools - New Construct ▸ Program… - typing its three sections (an empty but SET list, a Dict whose miss is unset, a collection as JSON), run them together, then ask the IDE /q 1019 about empty collections.
- Chapter 9: how a collection's type is worked out: Build the book's Inference program with the IDE's own tools - New Construct ▸ Program… - typing its three sections (lists whose types EK9 infers, an empty list that must say its type, a walk over a Dict), run them together, then ask the IDE /q 127 about collection type inference.
- Chapter 9: where promotion comes from: Build the book's Promotion program with the IDE's own tools - New Construct ▸ Function… and ▸ Program… - run an Integer promoted to a Float by #^ and by a call, then read Integer's operators with Analyse ▸ Effective API to find #^ declared by the type itself.
- Chapter 9: a collection as JSON: Build the book's JsonTaste program with the IDE's own tools - New Construct ▸ Program… - typing a Dict turned into JSON with $$ and a field read back with get, then ask the IDE /q 189 and read JSON's own surface with Analyse ▸ Effective API.
- Chapter 10: guards, reshaped: Build the book's Guards program with New Construct, type a plainer, declare-then-check draft first for each guard - a value declared, then checked with a separate '?' right after it - then use Lift into Guard to fold the two into one guarded head: a plain if, an if with an extra condition kept as 'then', and the same fold before a while and a for.
- Chapter 10: three ways to default a name, built: Build the book's Defaulting program with the IDE's own tools - New Construct ▸ Constant…, ▸ Function… and ▸ Program… (three of them) - the third drafted plain and turned into the coalescing expression by Wrap with coalescing…, then ask the IDE /q 1059 how to default an unset value.
- Chapter 10: safe minimum and maximum, wrapped: Build the book's SafeMinMax program: a plain draft typed, then Wrap with coalescing… turns each plain expression into the book's chain of <? or >? - the second wrap on the cheapest quote keeping the chain bare - so the cheapest and dearest of three quotes, one unset, are found safely.
- Chapter 10: a for loop that gives a value, built: Build the book's ForExpression program with the IDE's own tools - New Construct ▸ Program… - typing the for loop whose result becomes total, run it, then ask the IDE /q 80 about a loop as an expression.
- Chapter 11: an Optional, built: Build the book's lookupNumber function and Phone program with the IDE's own tools - New Construct, then Surround With ▸ if to fold the lookup under its test - and read Optional of String's own surface with Analyse ▸ Effective API before the program runs.
- Chapter 11: Optional and Result, built: Build the book's safeDivide function and Div program with the IDE's own tools - New Construct, then Surround With to fold the division itself under an if ... else head before the real branches are typed in - then read Result of (Integer, String)'s own surface with Analyse ▸ Effective API before the program runs.
- Chapter 12: a pipeline, built: Build the book's isEven/doubleIt functions and the Numbers program's stream pipeline with the IDE's own tools - New Construct ▸ Function… and ▸ Program…, typing only the logic no tool can write - then read it, stage by stage, with Analyse ▸ Pipeline before it runs.
- Chapter 12: a pipeline, and its tests, built: Build the book's shop: priceOf, isAvailable and the basketTotal pipeline with New Construct ▸ Function…, then the four @Test programs that check each stage and the whole with New Construct ▸ Test…, in shop/dev/tests.ek9 - typing only the price list, the pipeline and what each test claims - and run them with Run Tests.
- Chapter 13: data, an object and a function, built: Build the book's three building blocks side by side with the IDE's own tools - a Point record, a Counter class and an add function, each from New Construct, with Add Operator, Add Field and Add Method filling them in - and the program that uses all three, typing only the logic no tool can write.
- Chapter 14: a record, built: Build the book's Coord record - a point built complete in one step, or blank and filled in afterwards - and the moveTo function and program that use it, with the IDE's own tools: New Construct ▸ Record… with its Fields table, Add Constructor ▸ (From All Fields, then No-Arg default), Add Operator ▸, ▸ Function…, ▸ Program… - typing only the logic no tool can write.
- Chapter 14: an enumeration, built: Build the book's Day enumeration, in one call, and the function and program that use it with the IDE's own tools - New Construct ▸ Type ▸ Enumeration…, ▸ Function…, ▸ Program… - typing only the logic no tool can write.
- Chapter 14: what an enumeration comes with, built: Build the book's DayOperators program: New Construct ▸ Type ▸ Enumeration… makes Day and its seven values in one call, ▸ Program… makes Show, and the typed body tries what an enumeration gets for free - printing, ==, <, first and last, and a day built from text that is unset when it names no day.
- Chapter 15: a range and a pattern, built: Build the book's Ratio (a Float between 0.0 and 1.0) and Email (a String that must match a pattern) constrained types with New Construct ▸ Type ▸ Constrained… - the Constraint field changing its hint to suit each base type - and the program that tries good and bad values, typing only the program's body.
- Chapter 15: a constrained type, built: Build the book's DrivingAge constrained type, in one call, and the function and program that use it with the IDE's own tools - New Construct ▸ Type ▸ Constrained…, ▸ Function…, ▸ Program… - typing only the logic no tool can write.
- Chapter 15: promoting a constrained type, built: Build the book's chapter 15 Promotion program: New Construct ▸ Type ▸ Constrained… makes DrivingAge, ▸ Function… makes takesInteger and ▸ Program… makes Show, and the typed bodies promote a DrivingAge with #^ into a separate plain Integer that can change while the DrivingAge stays as it was.
- Chapter 15: stepping a constrained type, built: Build the book's Increment program: New Construct ▸ Type ▸ Constrained… makes DrivingAge in one call, ▸ Program… makes Show, and the typed body steps one up with ++ and down with -- - each change in place, the value still a DrivingAge.
- Chapter 16: a class, built: Build the book's Counter class and its program with the IDE's own tools - New Construct, Add Field, Add Method - typing only the logic no tool can write.
- Chapter 16: a class that hands out a copy, built: Build the book's ScoreBoard - a List field, a method with a parameter, and a summary that returns a Summary record holding copies - with the IDE's own tools, typing only the logic no tool can write.
- Chapter 16: a class that needs an owner, built: Build the book's Account class - no ownerless account can exist - with the IDE's own tools: Add Constructor ▸ Private No-Arg (default, pure) to seal off the empty constructor, and Add Method… with a parameter for deposit. The owner field and its one constructor, which no tool may write alone, are typed with the logic.
- Chapter 17: an abstract type and its subtypes, built: Build the book's Shape hierarchy with the IDE's own tools - a constant, Shape as abstract with two abstract methods, Circle and Rectangle each extending it with a field, a constructor and overriding methods, and the program that holds both in one List of Shape - typing only the logic no tool can write.
- Chapter 17: a family of records, built: Build the book's Contact record - abstract, with an abstract $ - and its Email and Phone subtypes with the IDE's own tools: New Construct ▸ Record… with an Extends: parent, which writes each subtype's override operator $ in the same call, Add Constructor ▸ and Add Operator ▸ - typing only the logic no tool can write.
- Chapter 18: traits that build on a trait, built: Build the book's Animals - a Named trait, three traits that each adopt it (Adopt Trait… on a trait's own name line), an abstract Animal with Bird and Reptile, and Penguin, Duck and Crocodile mixing the traits - with the IDE's own tools, typing only the values no tool can write.
- Chapter 18: traits and delegation, built: Build the book's View trait, Home and Framed classes with the IDE's own tools - New Construct, Add Method, Adopt Trait (both ways), Add Field, Add Constructor, Add Operator - typing only the logic no tool can write.
- Chapter 18: two traits, one method, built: Build the book's TraitClash: Priced and Monitored each declare lowCost, and Widget takes both - so it adopts Priced, writes its own lowCost naming Priced's, and only then adopts Monitored, because EK9 never picks a winner for you (E06150). Then a Gadget class takes Widget, and a program asks it.
- Chapter 18: a sealed family, built: Build the book's Payment trait, sealed to exactly Card and Cash, with the IDE's own tools - New Construct ▸ Trait… and ▸ Class…, Adopt Trait…, Add Operator ▸, then Change Modifier ▸ Seal Type… once the two classes exist to be listed - typing only the logic no tool can write.
- Chapter 19: a component, built: Build the book's Pricing component - a class and a function hidden behind an abstract interface, and the concrete StandardPricing and program that use it - with the IDE's own tools, typing only the logic no tool can write.
- Chapter 20: a generic type, read: Build the book's Show program - a List of String and a List of Integer, the one List filled two ways, then a Dict literal - with the IDE's own tools, then read List of String's own place in the type system with Analyse ▸ Type Hierarchy, and List of Integer's methods and operators with Analyse ▸ Effective API, before it runs.
- Chapter 21: operators, built: Build the book's Vec2 record with its own + and $, then default <=> and ? for the rest - New Construct ▸ Record… with its Fields table, Add Constructor ▸, and Add Operator ▸ Custom Operator… (an arbitrary operator - the fixed defaultable leaves cannot reach '+') beside the fixed defaultable leaves - typing only the logic no tool can write.
- Chapter 21: every other operator, in one step: Build the book's Release record - printed as 1.5 by a $ written by hand, sorted and compared by one bare 'default operator' line the compiler works out for itself - with New Construct ▸ Record…, Add Constructor ▸, and Add Operator ▸ $ (skeleton) and ▸ default operator (all missing), typing only the logic and the explanatory comments no tool can write.
- Chapter 21: promotion, #^: Build the book's Celsius record - its own $, and a #^ that promotes it to a Fahrenheit Float - with New Construct ▸ Record…, Add Constructor ▸ and Add Operator ▸ (its $ leaf and Custom Operator… for #^), then a program that promotes a Celsius and an Integer to a Float, and run it - typing only the logic no tool can write.
- Chapter 22: a notes-keeper with options, built: Build the book's Notes program: readNotes and writeNotes with New Construct ▸ Function…, the thin Notes program with its argv parameter from ▸ Program…, typing the try blocks and the option handling - then run it with -a milk and watch it keep a note in a file.
- Chapter 22: a program with arguments, built: Build the book's NoteLink program with the IDE's own tools - New Construct ▸ Program… with its CLI parameters table - typing only the logic no tool can write - then run it with an argument typed into Run Program…'s own Arguments field, and again from a saved run configuration whose own Environment field, opened with Run ▸ Configurations…, sets the web address Run Program… has nowhere to.
- Chapter 23: the game, built and played: Build the book's whole game - the Score record, the Game class, six small functions and the Guess program itself - with the IDE's own tools: New Construct ▸ Record…/Class…/Function…/Program…, Add Field…, Add Constructor ▸, Add Method…, Add Operator ▸ - typing only the logic no tool can write - then play it for real: Run ▸ Debug launches it live, and the Debug Console's own Standard Input row sends it a few guesses to a win, the way a person at a keyboard would (Run Program… alone never feeds a program's stdin).
- Chapter 23: running the tests, and the Journal: Run the fifteen tests that cover the game's record, class and functions, read the Tests tab and its coverage, then record one run of the WinningGame test and watch Game.tries change, tick by tick, in the Journal.
EK9 in Depth
The second book's examples, chapter by chapter, each built with the IDE's own tools - typing only the logic no tool can write.
- Chapter 24: settings, an Optional and a Result, built: Build the chapter's start-up routine: New Construct ▸ Constant… writes the two port limits, ▸ Function… the lookup that returns an Optional, the parse that returns a Result and the two callbacks, and ▸ Program… the shell; the logic - a guard, getOrDefault, matched isOk/isError checks and whenOk/whenError - is typed. Then run it.
- Chapter 24: the third safe container, built: Build the chapter's Iteration program: New Construct ▸ Program… writes the shell and the two reads are typed - next() inside the hasNext() that proves it, in a while loop and in an if. Then run it.
- Chapter 24: the four states of a Result, built: Build the chapter's ResultStates: New Construct ▸ Function… writes the pure helper that makes an unset String visible, ▸ Program… the shell; the four Results - neither, ok only, error only, both - and the Optional beside them are typed. Then run it and read what an unset String prints.
- Chapter 24: what keeps the proof, built: Build the chapter's SafeShapes: New Construct ▸ Constant… and ▸ Function… write the constant and the five small functions, ▸ Program… the shell; the checks - an and, a nested if, a call between the check and the read, a parenthesised group - are typed. Then run it.
- Chapter 25: one split, + and +=, built: Build the chapter's OperatorSplit: New Construct ▸ Record… writes Credit and its field, Add Constructor its two constructors, and Add Operator ▸ Custom Operator… (+ and +=) and $'s own entry write the operators; what each does is typed. + computes and must be pure; += mutates and must not be.
- Chapter 25: what pure promises, built: Build the chapter's PurityRules: New Construct ▸ Function… writes four signatures, pure ticked where the book has it, ▸ Program… the shell; the work is typed. Pure code may print and may be called by code that is not pure - and a pure GUID() still gives a new value each time.
- Chapter 25: copy, merge and replace, built: Build the chapter's CopyMergeReplace: a Profile record whose :=:, :~: and :^: operators are written by Add Operator and typed - copy takes everything, merge only fills gaps, replace lets what is set win - plus a shown helper function and the program that compares the three.
- Chapter 25: one object, two names, built: Build the chapter's Aliasing program: New Construct ▸ Program… writes the shell and the body is typed - a variable assigned from another is a second name for the same object, ++ and += change it in place, and Integer(count) makes a real copy. Then run it.
- Chapter 25: a copy that shares, built: Build the chapter's ShallowCopy: Team is written by New Construct ▸ Record…, Add Constructor ▸ From All Fields and Add Operator ▸ default $ and :=: with nothing left to type but the program - which shows a copied Team still sharing its members List.
- Chapter 25: the re-point head, built: Build the chapter's ThenGuard: New Construct ▸ Constant… and ▸ Function… write the constant and the lookup, ▸ Program… the shell; the three ifs - each a := re-point followed by 'then' and its check - are typed. Then run it.
- Chapter 26: nine pure shapes, built: Build the chapter's PureShapes: New Construct ▸ Function… writes nine pure functions - parameters, return type and pure set in the dialog - and ▸ Program… the shell; the program that holds each as the function type the compiler synthesised (Supplier, Predicate, Comparator...) is typed.
- Chapter 26: the impure twins, built: Build the chapter's ImpureTwins: the same nine shapes with pure left unticked, which the compiler types as Producer, Acceptor, Assessor, Routine and their Bi- forms - purity forks the hierarchy.
- Chapter 26: your own function type, built: Build the chapter's OwnFunctionType: New Function… with 'as abstract' ticked declares limit, a function type you name; a second function names it in Extends and is that type, and a third takes it as a parameter.
- Chapter 26: an abstract function as a contract, built: Build the chapter's TaxRules: an abstract taxRule, three concrete rules that are taxRule, and a pure ruleFor that returns the one a category needs - dynamic selection by a function value.
- Chapter 28: one data set, every verb, built: Build the chapter's OrderPipelines: New Construct ▸ Constant…, ▸ Record… (with Add Constructor and Add Operator), ▸ Function… and ▸ Program… write the constants, the Order record, eleven small functions and the shell; the pipelines - sort, tee, group, flatten, the two sinks, join, split and call - are typed.
- Chapter 28: replace or append, built: Build the chapter's ReplaceOrAppend: > replaces what a sink holds and >> adds to it, a replace is all or nothing, and a List can be sorted back into itself. The IDE writes the constant, the function that throws on the third item and the shell; the sinks are typed.
- Chapter 28: JSON as a sink, built: Build the chapter's OrdersAsJson: a record that asks for $$ with default operator $$, two small functions, and a program that pours the records into a JSON array with >> and > and collects a fresh one.
- Chapter 28: async is a stage, built: Build the chapter's AsyncLookups: New Function… with 'as abstract' declares the priceLookup type, four more name it in Extends, and the program sends them through async - in completion order, sorted, and cut by head.
- Chapter 29: the parent's version on purpose, built: Build the chapter's SuperCall: New Construct ▸ Class… (Open, then Extends), Add Field…, Add Constructor and Add Method… (override) write Account and SavingsAccount; the super(...) constructor and the overrides that call super.describe() and super.monthlyCharge() are typed.
- Chapter 30: a generic cache over two types, built: Build the chapter's LruCache: New Construct ▸ Constant… and ▸ Class… with Generic ticked - two type parameters, K and V, and the three fields in the dialog's table - then Add Method… for put, get, keys and a private touch, and ▸ Program… for the shell. The constructor's work and each method's logic are typed. Then run it.
- Chapter 30: a generic constrained by a trait, built: Build the chapter's PricedLedger: a trait with its ordering, two unrelated classes that adopt it (New Construct ▸ Class…, Adopt Trait…, Add Field…, Add Constructor ▸), and Ledger of type T constrain by Priced, whose body may call price() on every T. The ordering, the constructors and each method's logic are typed. Then run it.
- Chapter 30: the copy a generic asks every T for, built: Build the chapter's Shelf: a Book class with its constructors, and a generic Shelf that holds copies - T(item) - so Book must declare the copy constructor the template asks for. New Construct ▸ Class… (Generic ticked), Add Field…, Add Constructor ▸ and Add Method… make the shapes; the constructors and logic are typed. Then run it.
- Chapter 30: a generic function and a function type, built: Build the chapter's GenericFunctions: New Construct ▸ Function… with Generic ticked writes larger() of type T, and again with as abstract ticked the body-less transformer() of type T; ▸ Program… writes the shell. The comparison and the program - two made functions and two dynamic ones - are typed. Then run it.
- Chapter 30: a range over a type parameter, built: Build the chapter's RangeOverT: New Construct ▸ Function… with Generic ticked writes countFromTo() of type T, ▸ Program… the shell; the from ... to loop and the three uses - Integer, Character and Date - are typed. Then run it.
- Chapter 30: a constrained type over a record, built: Build the chapter's ConstrainedRecord: New Construct ▸ Record… writes Point with its fields, Add Constructor ▸ and Add Operator ▸ its defaults, ▸ Type ▸ Alias… the alias Coord and ▸ Program… the shell; the copy constructor, the > that takes an Integer limit and the constrained type PositiveQuadrant are typed. Then run it: a Point outside the quadrant is rejected.
- Chapter 31: a project of several files and two modules, built: Build the chapter's inventory: the pricing rules in a module of their own, an Item record in a file that declares the SAME module as main.ek9, the program and its package block (Code ▸ New Package…) in main.ek9, and four tests in dev/ (Code ▸ New Construct ▸ Test…). The references blocks and the logic are typed. Then run the tests: the project folder names mean nothing, the modules do.
- Chapter 31: the four comment forms, built: Build the chapter's Comments: New Construct ▸ Function… and ▸ Program… write the signature and the shell; the documentation comments above the module and the function, the line comment and the two block forms are typed. Then run it: to the compiler all four forms are hidden text.
- Chapter 32: an exception hierarchy and its dispatcher, built: Build the chapter's PaymentExceptions: New Construct ▸ Constant… and ▸ Class… (extending Exception, as open), Add Operator ▸, Add Field…, Add Constructor ▸ and Add Method… make three exceptions and a Till; the constructors' super(...) calls, the work and the two words that make handleFailure a dispatcher are typed. Then run it and watch each exception find its overload.
- Chapter 32: a catch that names its type, built: Build the chapter's NarrowCatch: New Construct ▸ Class… writes the exception (extending Exception, as open), Add Operator ▸ its isSet, ▸ Function… charge and ▸ Program… the shell; the constructor, the two throws and the two tries are typed. Then run it: the inner catch takes only its own type.
- Chapter 32: try as an expression, built: Build the chapter's TryExpression: New Construct ▸ Constant… writes the fallback port, ▸ Function… the portFrom that throws on a bad number, ▸ Program… the shell with its parameter; the try, whose value is either portFrom's answer or what the catch assigns, is typed. Then run it with a bad port.
- Chapter 32: when a resource closes, built: Build the chapter's ResourceOrder: New Construct ▸ Constant… writes the labels, ▸ Class… a Connection that can fail to open, Add Field…, Add Constructor ▸ and Add Operator ▸ close its shape; the constructor, the close and three tries are typed. Then run it: the catch and the finally run BEFORE the resources close, not after.
- Chapter 32: a holder that closes what it holds, built: Build the chapter's SessionClose: a Connection that prints when it opens and closes, and a Session that holds two of them and says default operator close - the compiler writes the close, last property first. Add Field…, Add Constructor ▸, Add Operator ▸ and Add Method… make the shapes; the logic and the fields no tool can write are typed. Then run it.
- Chapter 32: a close that fails, built: Build the chapter's SuppressedClose: a closeable whose close throws, and a report that reads suppressed(). New Construct ▸ Class…, Add Field…, Add Constructor ▸, Add Method…, Add Operator ▸ close and ▸ Function… make the shapes; the close that throws and the two tries are typed. Then run it: the body's own exception wins, and the close failure rides along.
- Chapter 32: the Panic a catch cannot see, built: Build the chapter's RequireExit: New Construct ▸ Function… writes averageOf's signature, ▸ Program… the shell; the precondition, the sum and the try with a catch and a finally are typed. Then run it to the Panic: the finally runs, the catch does not.
- Chapter 32: an exception that ends the program, built: Build the chapter's FatalExit: New Construct ▸ Function… writes loadSettings' signature, ▸ Program… the shell; the throw with its exit code and the try with only a finally are typed. Then run it to the uncaught exception and its exit code.
- Chapter 32: a program that returns its exit status, built: Build the chapter's ReturnedExit: New Construct ▸ Program… writes the shell with its parameter; the return line - New Program has no field for one - and the body are typed. Then run it: a program that returns an Integer exits with it.
- Chapter 32: exceptions inside a pipeline, built: Build the chapter's PipelineFailures: New Construct ▸ Function… writes parsePrice and parsePriceOrZero's signatures, ▸ Program… the shell; the throw, the stage's own try and the two pipelines - one stopped, one recovered - are typed. Then run it.
- Chapter 33: one lock over one record, built: Build the chapter's SharedTally: a Tally record under a MutexLock in a Ledger class, whose only way in is a key. New Construct ▸ Constant…, ▸ Record…, ▸ Class… and ▸ Function… (abstract), Add Field…, Add Operator ▸ and Add Method… make the shapes; the keys and the eight workers are typed. Then run it: eight workers, 2000 deposits, no race.
- Chapter 33: workers that share nothing, built: Build the chapter's WorkerTotals: New Construct ▸ Constant… writes the two counts, ▸ Function… with as abstract ticked the body-less work, ▸ Program… the shell; the eight dynamic workers and the async pipeline that collects them are typed. Then run it.
- Chapter 33: the answer a key would lose, built: Build the chapter's LostResult: an Account whose hasFunds first assigns its captured result with : instead of :=:. New Construct ▸ Class…, Add Field… and Add Method… make the shapes; the key is typed - wrong on purpose - and the compiler refuses the re-point (E08280). Type the fix, :=:, then run it and read the answer the caller now sees.
- Chapter 33: two locks, one order, built: Build the chapter's ConsistentOrder: a CacheService with two MutexLocks whose methods always nest the log inside the cache. Add Field… and Add Method… make the shapes; the keys are typed. Then run it: one direction is not a cycle.
- Chapter 33: one lock, nothing to order, built: Build the chapter's LockOrderFixed: both lists in one CacheState record under ONE lock - the fix ek9 -h E08252 gives for a real cycle. New Construct ▸ Record…, ▸ Class…, Add Operator ▸, Add Field… and Add Method… make the shapes; the keys are typed. Then run it.
- Chapter 33: the pair no lock can make atomic, built: Build the chapter's CheckThenAct: an Account with a check and a take as separate keys, and takeIfFunds doing both under one lock. Add Field… and Add Method… make the shapes; the four keys are typed. Then run it and read the difference: every operation was correct, the pair was not.
- Chapter 34: a contract, two implementations and two applications, built: Build the chapter's notifier example: New Construct ▸ Component… writes the abstract Notifier and its two implementations (the override stubs arrive with them), ▸ Class… the OrderService that asks for the contract, Add Field… the injection point, ▸ Application… the two wirings and ▸ Program… the two programs; only the logic is typed. Then run the development one.
- Chapter 34: the seams that make a game testable, built: Build the guessing game of chapter 34 in two files: the live game with its constants, pure functions, two abstract components and their live implementations, and - in dev/ - the test doubles, three test wirings and eight @Test programs made with New Construct ▸ Test…. Then run the tests.
- Chapter 35: two aspects on one component, built: Build the chapter's AspectOrder: New Construct ▸ Class… with Extends Aspect writes the labelled aspect (its constructor pair is typed, then Add Field… declares the label it assigns), Add Method… its two pieces of advice; ▸ Component… the Greeter contract and implementation, ▸ Application… a register line with TWO aspects in the With Aspect column, ▸ Program… the caller. Then run it and read the order the advice ran in.
- Chapter 35: a timing aspect and its own data, built: Build the chapter's PriceBook: a logging aspect, TimerData (a PreparedMetaData that carries the start time) and TimerAspect (whose before advice returns it and whose after advice takes it back), a StandStillClock made with Adopt Trait…, the PriceBook component, and an application that applies both aspects. Add Operator… writes the default operators TimerData must declare, Add Field… the fields its constructors assign. Then run it.
- Chapter 35: an aspect around a method that throws, built: Build the chapter's AspectException: a logging aspect with Add Method…, Add Operator… for the default ? an aspect without fields still needs, a PaymentGateway component whose implementation throws on a negative amount, the application and the caller that catches. Then run it and see what the advice does around a failure.
- Chapter 35: an aspect that counts calls, built: Build the chapter's CallCounter: New Construct ▸ Class… with Extends Aspect writes the aspect, Add Field… its counter and Add Method… its two pieces of advice; ▸ Component… the Worker contract and its implementation, ▸ Application… the register line whose With Aspect column attaches the aspect, ▸ Program… the caller. The advice bodies and the calls are typed. Then run it.
- Chapter 36: a server and its own client in one process, built: Build the chapter's EchoInProcess: New Construct ▸ Function… with Extends TCPHandler writes the echo handler (its parameters are the connection's input and output), ▸ Program… the shell; the server, the ready handler that calls the client and stops the server, and the try that closes it are typed. Port 0 on the loopback address: nothing is fixed and nothing outside the machine can reach it. Then run it.
- Chapter 36: a TCP line server and its client, built: Build the chapter's two TCP programs in two files: the line server (constants for the port and the word that stops it, a handler that captures the server) and the client that takes its message as an argument. New Construct ▸ Constant… and ▸ Program… write the shells; the loopback-only networking logic is typed.
- Chapter 36: a UDP echo server and client, built: Build the chapter's UDP pair in two files: the server that sends every packet back and stops on the word end, and the client with its timeout and an exchange function. New Construct ▸ Constant…, ▸ Function… and ▸ Program… write the shells; the packets are typed.
- Chapter 36: UDP as a stream pipeline, built: Build the chapter's UDP pipeline pair: an abstract function as the contract (New Construct ▸ Function… with 'as abstract' ticked), the server that is one cat-map-print pipeline, and the client that maps strings to packets into the connection. Built, not run: the server is stopped by a signal.
- Chapter 36: where a program's URLs come from, built: Build the chapter's CheckDestinations: New Construct ▸ Function… writes report, ▸ Program… the shell; urlFromEnv, the one question destination? and the three variable names are typed. Then run it: none of the variables is set, so each line says so.
- Chapter 36: links from a base URL, built: Build the chapter's NoteLinks: New Construct ▸ Program… with its one parameter writes the shell; the URL building - resolve, withPathSegment, withQueryParam - is typed. Then run it with 42.
- Chapter 36: a service and its HTTP client in one process, built: Build the chapter's ServeAndCall: New Construct ▸ Function… writes the two functions (one reads a Result of an HTTPClientResponse, one calls the service three ways), ▸ Service… the Greeting route whose parameter reads the path variable, ▸ Application… the registration; the program is made unbound and its header and body typed, because a program bound to a service must create the HTTP server itself. Port 0 on the loopback address, stopped by the program. Then run it.
- Chapter 37: the smallest web service, built: Build the chapter's HelloNotes: ▸ Service… writes Greeting and its one route - the Parameters cell reads personName String PATH name - ▸ Application… registers it and ▸ Program… writes the shell; the response text and the serving program (localOnly, on a fixed port, stopped by a TERM signal) are typed. Built, not run: the server waits for TERM.
- Chapter 37: JSON in and out, built: Build the chapter's JsonDocuments: ▸ Record… writes Note with its fields, Add Constructor… its default one, Add Operator… the JSON form $$; ▸ Function… writes textOf and describe, ▸ Program… the shell. The parsing, the unset fields and the broken bodies are typed. Then run it.
- Chapter 37: two routes that could both match, built: Build the chapter's RouteOrder: ▸ Function… writes plain, ▸ Service… writes Words with a path-variable route and a query-parameter route, ▸ Application… and ▸ Program… finish it. The responses are typed to answer through plain. Built, not run: the server waits for TERM.
- Chapter 37: a key that cannot be printed, built: Build the chapter's SyncKey: ▸ Function… writes authorisationFor, ▸ Class… NoteSync, Adopt Trait… makes it Privileged, Add Field… and Add Method… the key and the header it builds; the constructors and the program that tries to print the key are typed. Then run it.
- Chapter 37: a status decided late, built: Build the chapter's LateStatus: ▸ Class… and Adopt Trait… make LateResponse an HTTPResponse, Add Field… and Add Method… give it its code and its three methods; ▸ Service… writes Late with one route that returns it. Built, not run: the server waits for TERM.
- Chapter 38: a package to share, built and packaged: Build the chapter's greeter package: New Construct ▸ Function… writes the four greeting functions and ▸ Program… the thin program, the defines package block - the manifest - is typed after the code, and ▸ Test… writes the four tests. Then Build ▸ Package… (which refuses unless the tests pass with 80% coverage) writes the source archive and its checksum, and Install Package puts them in a library made for the lesson - never your own ~/.ek9.
- Chapter 38: declaring what a package may do, built: Build the chapter's EnvironmentGreeter: New Construct ▸ Program… writes the shell, you type the logic and a package block that declares only Stdout - and the compiler refuses EnvVars with E12010. The error site's own quick fix, Add capability 'EnvVars' to package, repairs it. Then run the program with the variable unset and set from a run configuration.
- Chapter 38: a library to depend on, built and installed: Build the chapter's book.shapes.lib library: New Construct ▸ Constant… and ▸ Function… write the constant and the two area functions, the defines package block is typed, and ▸ Test… writes the two tests. Then Build ▸ Package… and Install Package put the archive in a library made for the lesson, where a consumer's deps entry would find it - never your own ~/.ek9.
- Chapter 39: three kinds of test, one runner, built: Write the tests of the chapter's pricing and checkout module: New Construct ▸ Test… makes each @Test - assertion tests, one bound to an application, a black-box test with its own stand-in (▸ Component… and ▸ Application…) and a parameterized test - and you type what each claims. The expected-output and case files sit beside them. Then Run Tests runs all three kinds in one runner.
- Chapter 40: what coverage cannot say, built: Build the chapter's postage function and its six tests: New Construct ▸ Constant… and ▸ Function… write the constants and the function, ▸ Test… every test's shell; the branches and the claims are typed. Run ▸ Quality Report after the first test (coverage short of the gate, exposure high) and again after all six (every branch ran, exposure lower) and read HEX - hazard times exposure - move.
- Chapter 41: substitution, as the compiler checks it, built: Build the chapter's Substitution: New Construct ▸ Class… and Add Method… write Shape with its pure abstract area(), ▸ Class… with Extends each subtype (its override area() stub arrives with it), Add Field…, Add Operator ▸ ? and Add Constructor ▸ From All Fields the rest; only each formula, the describe function that knows no subtype and the program are typed. Then run it.
- Chapter 41: the tri-state operators, built: Build the chapter's TriState: New Construct ▸ Constant… and ▸ Function… write the two constants and the two functions that make a set or an unset value on demand, ▸ Program… the three programs; the answers and the logic - :=? assigning only when unset, ?: supplying a fallback, an unset operand leaving an unset sum - are typed. Then run each program.
- Appendix: a literal of every type, built: Build the appendix's Literals program: New Construct ▸ Program… writes the shell and the twenty-three literals - date, duration, money, version, dimension, regex, JSON path - and the eight lines that print them are typed. Then run it and read what each literal printed.
Refactoring
Rename, extract, inline, change a signature, move: each previewed before it is applied.
- Extract Constant: Give a literal a name: a constant defined once, and every use of the literal in the file replaced by it.
- Rename Symbol: Rename a name and every use of it, wherever it is - for a name that says nothing of what it holds.
- Extract Variable: Give part of an expression a name: a local that holds it, and the expression using the name.
- Change Signature: Add, remove or reorder a function's parameters, and every call to it changes with them.
- Extract Method: Move a block of statements into a function of its own, called where the block was - nesting comes down.
- Safe Delete: Remove a class, function, method or field once nothing uses it - here an override that repeats its super.
- Unused Code: Scan the workspace for every callable nothing reaches - grouped dead ahead of test-only ahead of untested public API - then remove one straight from the window with Delete safely…, the SAME compile-checked preview Safe Delete opens from a declaration.
- Organize Constants: Gather every constant of a module into one file - here three files' constants into a file of their own.
- Organize References: Delete the unused entries of a file's references block - usage judged by a scratch compile, so a name collision never fools it.
- Sync References: Add the missing entries AND delete the unused ones of a file's references block, in one pass - the EK9 'Organize Imports'.
- Inline Variable: Put a local's value where it is used and remove the local - for a name that says no more than its value.
- Introduce Parameter: Turn a value a function uses into one its callers pass, the old value passed at every call.
- Inline Function: Put a function's body in place of every call to it and remove it - for a function that adds nothing.
- Move Construct: Move a construct to another file - and module - with every reference to it following.
- Lift into Guard: Turn a declare-then-check pattern into one guarded head - a control construct that enters only when its variable is set, the separate check gone.
- Wrap with coalescing: Wrap a selected expression in one of EK9's null-safe operators: ?: defaults an unset value, <? and >? return the lesser or greater of two operands.
- Make Open: Add 'as open' to a closed class, record, component or function, so it can be extended.
- Fix Purity Contract: Add or remove 'as pure' on the callable a purity error names, from the Blast Radius pane - here an override missing the purity its parent promises.
- Implement Methods: Insert an override stub for every abstract trait method a class has not yet implemented.
- Rewrite String Concatenation: Rewrite a
+string concatenation of three or more parts into the equivalent backtick interpolation. - Pull Up: Promote a method or operator from a subclass into its superclass, where every subclass can use it.
- Push Down: Relocate a method or operator from a superclass into the subclasses you choose - removed from the superclass, copied into each one picked.
- Extract Trait: Pull a class's public methods out into a new trait it then implements - the class keeps its bodies and gains 'with trait of' and 'override'.
- Adopt Trait: Add 'with trait of' and a trait's name to a class or component - an override stub for every abstract method, or forward them all to an existing field instead.
- Make Abstract: Add 'as abstract' to a class, record, component or function directly - instead of implementing every member it owes.
- Make Closed: Remove 'as open' from a class, record, component or function, returning it to EK9's closed-by-default.
- Make Concrete: Remove 'as abstract' from a construct whose abstract members are all implemented, so it can be instantiated directly.
- Seal Type: Add an 'allow only A, B, C' clause to a class or trait, restricting extension to exactly the subtypes listed.
- Unseal Type / Add to Allowlist: Widen an already-sealed type's 'allow only' list by one entry from the error site itself, or remove the clause entirely - two ways to clear the same E05240, from two different distances.
- Introduce Field: Lift a local and its initialiser up to a field of the enclosing class, record or component, keeping the same name - state the whole construct shares, not just the one method that declared it.
- Rename Field: Rename a field and every reference to it inside its owning construct - bounded to the one construct, because EK9 fields are private to their declaring construct.
- Remove Field: Delete a field from a class, record or component once every reference inside that construct's body is classified and, where mechanical, repaired.
- Change Visibility: Narrow or widen a method's access modifier - the submenu only offers the moves that are legal for the method under the caret.
- Surround With: Fold a selection of whole statements under an if, try/catch, for-range or while head - the tool re-indents them, since EK9's brace-free layout is never mis-typed by hand.
- Generate Delegation: Wire a trait the class already declares to an existing field with 'by' and the field's name, so the compiler forwards every trait method to it - no stub bodies to fill in.
- Generate Dispatcher: Scaffold a dispatcher entry and one handler overload per subtype of a base type - sealed for exhaustive dispatch, or open with the entry's fallback covering the rest.
- Extract to Localized Text: Move a hard-coded string out of the code and into a localized text method, rewriting the call site to use the text variable already in scope.
- Organize Localized Text: Gather a module's localized text into one of three layouts: one file per locale, one file per text type, or everything collapsed into a file you name.
- Inline Candidates: Find locals whose name adds little over their initialiser, bucketed worth-inlining ahead of mechanically-safe - then inline one straight from the window.
- Promote to Constant: Move a
name <- literaldeclaration - a property or a local - into the module's defines constant block, keeping the same name. - Convert Constructor: Swap a no-arg constructor between its two equivalent forms: 'default Name()' and an explicit body that sets every field with :=? - ready to customise, or collapsed back once it is not.
- Expand Default Operator: Replace a 'default operator' line (default operator $, == and the like) with the explicit body the compiler would synthesise from the fields - ready to customise, or collapsed back once it is not.
- Rename File / Move File: Relocate a .ek9 file on disk, contents untouched - Rename edits the basename in place, Move edits the whole path into another directory - because EK9 module identity comes from the file's own 'defines module' line, never its name or location.
- Toggle Comment, Remove Comment, Reformat: Four code-tidying actions with no dialog and no preview: Toggle Comment wraps whole lines in EK9's <!- -!> block form without deleting them, Remove Comment deletes a comment outright, and Reformat File / Reformat All Open Files re-render a file - or every open file - in canonical EK9 style.
- New EK9 File, New Directory, Delete File, Delete Directory: The Project panel's own right-click menu: make a new .ek9 file (the three-part boilerplate also written by ek9_write_file) or a new directory, and delete a file or an empty directory - each commits straight to disk, no preview.
Running and testing
Run configurations, tests and the Tests tab, coverage.
- Run configurations: Run > Run Program… for a run you will not repeat, then Run > Configurations… to save several configurations for one program - each its own arguments and environment variables - the toolbar's picker to switch between them and run one with a click, and the gear to edit one and run it again.
- Running tests: The ▶ beside one @Test to run it on its own, Run Tests for every @Test in the project, the Tests tab's pass/fail list with a link from a failing test straight to its declaration, and coverage highlighting over what a run actually executed.
- The Terminal: The Terminal tab: your own login shell, started in the project's folder with the ek9 command this IDE runs from already on its PATH - list the folder, ask for the version, then compile and run a program from the shell with nothing but the command line.
Quality and reports
The quality report, complexity and the other measures.
- The quality report: Run > Quality Report, the pass/fail pill, why Verification's centre number is asserted rather than covered, Coverage Detail, a module then a file with its own covered/uncovered lines, and one of the DI Wiring / Module Dependencies / Type Hierarchy pages.
- Generate Edge-Case Tests: Code > Generate > Edge-Case Tests (whole file) writes @Test scaffolding with //AI: lines marking every expectation still to decide; running it turns some red - one because the naive guess was wrong, one because the code has a real off-by-one - and the report's Input Variety and Verification rise once both are resolved.
- Complexity limits and budget bars: View > Toggles > Complexity Badges in the editor, then the report's own budget bars against the compiler's hard limits (45 cyclomatic, 35 cognitive) and what a method sitting near half its budget looks like.
- Contracts and risk: The report's Risk profile - hazard times exposure, and its Worst measured and Worst approximate constructs - and its Contracts: obligations the compiler has discharged against those still unproven, then the on-demand solver (Generate Edge-Case Tests with Verify-directed) that answers an unproven one with a failing input or "verified to bound".
Debugging and the Journal
Breakpoints and stepping, and the Journal: a run recorded and read backwards to its cause.
- Breakpoints and stepping: Click the breakpoint column to stop a line every time it runs, then step - Over without leaving the line that called it, Into to follow a call, Out to come back - and Run to Cursor for a one-time stop with no breakpoint left behind.
- Breakpoint conditions: Add a condition to a breakpoint so it stops only when a value holds - read from the program, never changed by it, checked every time the line runs - a hit count and a log message are the same dialog's other two fields.
- Watches: Add a watch on a value - a class field included, even one EK9 itself keeps private, since the debugger reads fields, not EK9 code - then break only when it actually changes, wherever that happens to be; a Sensitive value in a watch stays masked, set or unset plus a fingerprint, never its raw text.
- The Journal: one run: Record every change to one value while a program runs, then read the failure backwards to its cause.
- The Journal: comparing runs: Record several runs, choose a passing one and the failing one, and see what only the failing run did; then write it up as a Journal Report.
- The Journal: a new investigation: Run an investigation, then run it again with one input changed - the Journal's own way to try a variation - and see what that changes.
Understanding a codebase
The Analyse views: what calls what, what depends on what.
- Show Blast Radius: See who a purity change would reach before you make it - the callers that break if pure is removed, the callees that must become pure if it is added - from the right-click Show Blast Radius item, at the point of pain.
- Five views, one construct: Read ONE construct five ways from the Analyse menu - Construct (its shape), Scope (what's visible at the caret), Effective API (everything you can call), Flow Analysis (how a method branches) and Pipeline (a stream chain, stage by stage) - on a small class built so each view has something real to show.
- Type Hierarchy and Dispatcher: Read a type's place in its hierarchy - its super chain, the trait it implements, its known subtypes - from a subtype's own view and from the abstract base looking down; then a dispatcher's own resolution table, which concrete type resolves to which handler, and the one a non-exhaustive dispatcher leaves to fall back.
- Call Graph and Neighbourhood: Read who calls a function or method and what it calls in turn - colour-coded by construct kind, a dashed border for a polymorphic call site - across a project's files; then a construct's own neighbourhood, what it extends, implements, composes or references, radiating out by hop.
- Modules and Packages: Read a project's shape from above - Module Landscape (a card per module, its coupling and what it holds), Module Dependencies (the modules in layers, a red dashed line where two refer to each other) and Package Dependencies (whether the project's packages depend on each other in a circle) - on a small shop built with a module cycle in it.
- Service Routes and DI Wiring: Read a web service's attack surface - every route with its verb, path, handler, security gate and parameters - and how an application wires its components and services, which injection sites each registration satisfies, all from the compiled program: nothing is run, no port is opened.
- Locks and Deadlocks: Read a program's MutexLocks - the Lock Catalogue of every lock identity, the Lock Fingerprint of one method (the locks it enters, the key bodies it runs, what it may enter through its calls) - then the Deadlocks view, safe for a lock nested one way and red the moment a second method nests the same two locks the other way round (E08252).
- Localisations: The Localisations window - the locales in play, how far each module is translated, where a locale is missing - then Add Locale… to put a missing locale right (stubbed for translation) and Remove Locale… to take one away.
Security, packages and Git
Sanitised input, packages and their versions, and Git.
- Capabilities: The security-capability audit window: every gated system type the code uses against what the package declares - under-declared (the E12010 set) fixed with Add Capability, over-declared (declared but unused) tidied with Remove Capability.
- Sensitive reveals and environment variables: The two audit windows for a program's secrets: Environment Variables groups every EnvVars read by how its value enters the program (Sensitive first, then Unsanitized), Sensitive Reveals lists every reveal() by legality with the E11090 violations first - both show where, never a value - and adding Privileged to the offending class moves its reveal to the legal group.
- The package block: Right-click inside a defines package block: Set Version… and Increment Patch Version change the version (the build counter is managed apart), Add Dependency… appends a pinned module and Exclude Transitive Dependency… blocks one a dependency would bring in - each a previewed edit of the package source, nothing fetched.
- Git: stage, commit, push, pull: The Git window: the working tree grouped as Staged, Modified and Untracked, Stage and Commit… (⌘K), Push, Fetch and Pull another person's work, and Branches… to start another line of work - on a repository made for the lesson, its remote a folder beside it.
- Git: history, stash, annotate, merge: Show Git Log and its branch graph, Annotate (git blame) in the editor's gutter, Stash Changes… then Pop from the Stashes window, and Merge Branch… with its preview - on a repository made for the lesson, with a branch waiting to be merged.
- Build: package, install, sign, deploy: The Build menu's packaging items on a publishable package: Resolve Dependencies, Package… (which runs the tests and checks their coverage), Install Package into the library, Generate Signing Keys, and Deploy Package… up to its confirmation - then Cancel. Played in a home folder made for the lesson, so your own ~/.ek9 is never written.
Fixing errors
Every error EK9 reports is explained - in the Help tab, or by ek9 -h and its code - and the explanation ends with "Show me how to fix it": a lesson that opens the error's example and fixes it, step by step. They are listed in the error index.
The menus
Each menu holds one kind of action. Right-click in the editor for everything that applies where the caret is, or use Refactor > Refactor This… (Ctrl+T) for the same menu from the keyboard.
| Menu | What it holds |
|---|---|
| File | New Project…, Open Project…, Recent Projects, Save, Save All, Settings… |
| Edit | Undo, Redo |
| Code | Code you write or have written for you: New Construct, New Package…, dynamic functions and classes, Localisation, Generate (Implement Methods…, Delegation…, Dispatcher…, Edge-Case Tests), Reformat, Toggle Comment, Organize References |
| Refactor | Code reshaped without changing what it does: Refactor This…, Rename Symbol…, Change Signature…, Safe Delete…, Extract Method…, Extract Variable…, Introduce Parameter…, Inline Variable, Inline Function…, Move Construct…, Organize Constants… |
| Build | Compile Project, dependencies, packaging, signing keys, Versioning |
| Run | What runs: Run Tests, Quality Report, Journal Report, New Journal Investigation…, Run Program…, Configurations… |
| Analyse | Views that explain the code: one construct (Construct, Scope, Effective API, Flow Analysis, Pipeline), how constructs and modules relate (Module Landscape, Dependencies, Service Routes, DI Wiring, Neighbourhood, Type Hierarchy, Call Graph, Dispatcher, Blast Radius) and locks (Lock Catalogue, Deadlocks, Lock Fingerprint) |
| View | The IDE's layout: the AI Control Centre, Bottom Panes, Tool Windows, Toggles |
| Navigate | Go to Definition, Find Construct…, Go to Line…, Find References, Next Error, Previous Error |
| Git, Window, Help | Version control; detached windows; Getting Started, the paradigm, Documentation, Licences |
Using VS Code or IntelliJ instead
The EK9 extension for VS Code (vscode-ek9-ls) starts the EK9
language server, ek9 -ls. The server reports the compiler's errors as you type, and answers hover, completion,
go to definition and find references.
The EK9 plugin for IntelliJ (intellij-ek9-ls) uses the same
language server, and the EK9 debug adapter, ek9 -dap, for breakpoints. It needs the LSP4IJ plugin installed first.
The language
This section covers the IDE. The language itself is in the EK9 language reference, starting with Structure.
