Lessons

Tcl · Medium

Tcl · Medium. Ten lessons. Open-book quizzes. Lesson 1 free.

10 lessons · The Host · Lesson 1 free

Pass all ten lessons for the certificate. Sample · Claim

  1. Namespaces in depth: export, import, path and ensemble maps

    Lesson 1 · On the house

    Namespaces in depth: export, import, path and ensemble maps

    Take qualified names apart, share commands with export and import, resolve names through namespace path, and map ensemble subcommands to any command.

  2. Packages and modules: package require, pkgIndex.tcl and .tm files

    Lesson 2

    Packages and modules: package require, pkgIndex.tcl and .tm files

    Ship code as a versioned package, find it through auto_path and pkgIndex.tcl or a Tcl module file, state version needs, and load files with source.

  3. TclOO classes: constructors, methods, my and self

    Lesson 3

    TclOO classes: constructors, methods, my and self

    Define classes with oo::class, give objects state with variable, call your own methods with my, hide helpers, clean up in a destructor and inspect objects.

  4. TclOO inheritance: superclass, next, oo::define and mixins

    Lesson 4

    TclOO inheritance: superclass, next, oo::define and mixins

    Inherit with superclass, chain to parent constructors and methods with next, add methods to live classes, and layer behaviour in with mixins.

  5. TclOO extras: forward, filters, per-object methods and unknown

    Lesson 5

    TclOO extras: forward, filters, per-object methods and unknown

    Delegate methods with forward, wrap every call with a filter, give one object its own method, catch undefined methods with unknown, and add class methods.

  6. Return codes and error options: catch, return -options and -level

    Lesson 6

    Return codes and error options: catch, return -options and -level

    Read the full options dict from catch, raise errors with an -errorcode, write loops that honour break and continue, and re-throw without losing details.

  7. Traces: watching variables, commands and execution

    Lesson 7

    Traces: watching variables, commands and execution

    Run code when a variable is written, read or unset, validate or clamp values, watch renames and deletes, and log every call to a proc.

  8. Interpreters: child interps, aliases, safe interps and limits

    Lesson 8

    Interpreters: child interps, aliases, safe interps and limits

    Run code in a separate interpreter, connect it to yours with interp alias, sandbox untrusted scripts with -safe, and stop runaway code with limits.

  9. Introspection and code that writes code: info, apply and lsort -stride

    Lesson 9

    Introspection and code that writes code: info, apply and lsort -stride

    Read a proc's arguments, defaults and body, generate procs from data, build lambdas that compose, and sort or map flat key-value lists.

  10. Channels in depth: encodings, line endings, pipes and sockets

    Lesson 10

    Channels in depth: encodings, line endings, pipes and sockets

    Control line endings and text encodings on channels, convert strings to bytes, copy channels, and run a localhost socket server with chan event.

Sample certificate

Certificate of completion

Sign in to claim your certificate of completion.

Certificate

Finish all ten lessons, then sign in

Pass every lesson on this device (quizzes and checks). Then sign in or create an account to type your name and download the JPG.

All lessons