Repository navigation
Oak 0.2!
There's been a huge wave of improvements, fixes, and additions since v0.1 less than two months ago. The highlights include a static site generation system for the Oak website, expanded standard library modules, a much-improved and optimized Oak-to-JavaScript compiler, a built-in syntax highlighter, and oak eval / oak pipe commands.
std := import('std')
Oak := { version: '0.1' }
Oak |> std.merge({ version: '0.2' })Standard library additions
std.(take, takeLast)in the standard'std'modulestd.stdinto read all of standard input in the'std'modulestd.loopcan now return meaningful values from within the loopstr.trimStartandstr.trimEndnow have forms with optional second argument, which will trim all whitespace to match the behavior ofstr.trimsqrt, hypot, scale, bearing, orient, prod, clampin the standard'math'module- Statistics functions
mean, median, stddevin the standard'math'module t.approxfor comparing floating-point values in the'test'modulefmt.formatnow also accepts format string variables that key into objects, rather than integer-index into the argument list. This means expressions likefmt.format('{{ name }}: {{ age }}, userProfile)work.
Improvements
- Boolean combinators
&and|now short-circuit in Oak oak catfor syntax highlighting Oak files in the command lineoak evalandoak pipefor evaluating Oak code from the UNIX command line- The
try()built-in function for interoperability with JavaScript's checked exceptions - Many rounds of optimizations went into the
oak build --webcompiler, including a few passes focused on bundle size. - The
oakbinary can now evaluate Oak code from standard input. - The router in the
'http'module now accepts any HTTP header, including OPTIONS, HEAD, and others. - The standard testing module
'test'how usesdebug.inspectto pretty-print outputs of failing tests for more readable test results. - Tokens from
syntax.Tokenizernow contain their byte offset position in the source file, in addition to line and column numbers. - The
input()built-in function now reads from a single global buffer, and is capable of reading large files from standard input.
Fixes
- Fixed infinite recursion from circular imports in bundles generated by
oak build. - Deleting keys with
o.key := _now always works in JavaScript contexts. str.(lower, upper)are more idiomatic and faster.str.(upper?, lower?, digit?, space?, startsWith?, endsWith?)are faster.- Fix malformed format strings crashing
fmt.format. - Guard against XSS vulnerabilities in the
'md'standard library module. oak build --webnow uses the JavaScript null coalescing operator??for safer and smaller bundles.- Fix some parser crashes caused by malformed Oak syntax input.
- Improve error messages from
syntax.Parserto always include the syntax error position. - The
req()built-in function now correctly returns an error event instead of crashing if the HTTP connection fails to establish.
oaklang.org is live!
The Oak website has gotten to a point where I can officially say it's not "incomplete". There's still not much documentation on the site about the language or the standard libraries, but there is:
- A directory of syntax-highlighted standard library source files
- A blog with stories and deep-dives about Oak and Oak-based projects
- A "highlight proxy" for syntax-highlighting Oak files on the web