Goal: Website has snippets that are checked and linkified. Goal: Offer actions when runtime errors occur.
Added ^
to concatenate strings.
Added **
to raise a number to a power.
assert
is now syntax rather than a built-in function. The symbol
assert
is now a reserved word.
Removed String::append
.
Added String::replace
, List::enumerate
, lex
and check_snippet
.
List::get
now returns an option rather than erroring on
out-of-bounds access.
Fixed several type checking bugs on type parameters in methods.
The unused function check now reports functions that are only used in tests.
Renamed eval_up_to_id
JSON command to eval_up_to
.
The check --json
CLI command now returns line and columns in its
output, instead of offsets.
Goal: Speculative sandboxed execution of tests and completions.
Added a Path
type, with methods Path::exists
, Path::extension
,
Path::file_name
, Path::join
, Path::parent
and Path::read
.
Added List::slice
, Option::is_some()
, Option::is_none()
and
Option::or_value()
.
list_directory
and working_directory
now return absolute Path
values. list_directory
now takes a Path
argument.
Removed path_exists
(use Path::exists
instead) and read_file
(use Path::read
instead).
String
methods are now substantially faster, 10x in common cases.
Added source_directory()
, assert()
, range()
and removed
should_equal()
.
Removed List::for_each
(use for x in y
loops instead).
Type parameters now occur after function or method names, so Garden
programs are more easily searched with grep
or rg
.
// Old
fun<T> foo(items: List<T>) {}
// New
fun foo<T>(items: List<T>) {}
Tests now require a name, so test {}
is no longer legal. Use test some_name {}
instead.
Added %
, +=
and -=
operators.
Fixed several type checking bugs.
Added a destructure
and an extract-function
CLI commands.
Goal: WASM and website. Goal: Less compulsory punctuation following eval-up-to-cursor testing.
Expressions no longer use trailing semicolons, so let x = 1;
is now
let x = 1
.
Added tuples, e.g. (1, "Foo")
.
Added for x in some_list
loops, and added continue
to both while
and for
loops.
Variable shadowing is now supported, so the following is legal:
let x = 1;
let x = x + 1; // 2
Struct literals now require the opening brace to be touching the type
name, so Person { name: "wilfred" }
is now written
Person{ name: "wilfred" }
.
while
loops, match
expressions and if
expressions no longer
require parentheses, so while x {}
, match x {}
and if True {}
are now valid.
Fixed an interpreter crash when evaluating tests.
Added List::for_each
, List::is_non_empty
, String::chars
and
Bool::not
.
Fixed several type checking bugs.
Goal: Evaluate functions up to the cursor.
Added an eval_up_to_id
JSON command that allows functions or blocks
to be evaluated up to a specific expression. For functions, the
previous argument values used are passed in.
The command :methods
now takes an additional argument, to only
show items matching that substring, e.g. :methods Str
.
Fixed several crashes, particularly on incomplete programs.
Goal: Basic IDE features.
Added a command garden show-type foo.gdn 123
that shows the type of
the expression in file foo.gdn
at offset 123.
Added a command garden definition-position foo.gdn 123
that shows
the definition position of the symbol in file foo.gdn
at offset 123.
Added a command garden definition-position foo.gdn 123
that shows
the definition position of the symbol in file foo.gdn
at offset 123.
Added a command garden complete foo.gdn 123
that shows all the
methods available for the type of the expression in file foo.gdn
at
offset 123.
Configured Emacs mode to show hover information, provide go-to-def and code completion.
There is now a syntax for function types. For example, Fun<(Int, Int), Int>
is the type of the function fun(x, y) { x + y; }
.
dbg
now returns its argument, so it can be added to subexpressions.
Added String::split
, List::map
and List::last
.
Renamed String::concat
to String::append
.
The type checker now solves generics on arbitrary user-defined types.
The type checker also handles many more expressions correctly.
Garden now requires Rust 1.78 to build.
Fixing bugs with the GitHub actions for uploading releases to crates.io.
Goal: Implement generics. Goal: Implement type checker.
Added break;
inside loops. continue
is now a reserved word.
let x = y;
now evaluates to Unit
rather than y
.
Type hints for built-in types are now checked for the correct arity
(e.g. List
or String<Foo>
).
Added a basic type checker.
Added methods write_file()
, String::trim_left()
,
String::trim_right()
, String::starts_with()
,
String::ends_with()
, String::strip_prefix()
,
String::strip_suffix()
, String::split_once()
and
Option::or_exception()
.
Added function todo()
.
list_directory
now returns a Result
.
Fixed a crash on shell()
with a nonexistent command.
:doc
now prints the position of functions.
:funs
now only shows callable values in the file scope.
If tests fail, the test runner now has an exit code of 1.
Garden now requires Rust 1.73 to build.
Goal: Add structs.
C-c C-z
now toggles between session and source code buffers.
Added the read_file
function.
shell
now returns a Result
, where Err
represents a non-zero exit
code.
Added Result::or_error()
.
Added a NoValue
type.
Added structs.
Match cases now support an optional trailing comma.
match (x) {
None => 0,
Some(i) => { i + 1; }
}
return;
is now syntax sugar for return Unit;
.
Added a type hint arity checker.
Added a placeholder site with a parser sandbox.
Added pattern matching.
match (x) {
Some(i) => { i + 1; }
_ => 0
}
Added the Result
type.
Added the List::first
method.
:source
now shows the source code of a single definition, rather
than the session history.
Fixed an issue where use of function parameters would generate a warning about unbound symbols.
Goal: Warn on loading functions with free variables.
A warning is generated when loading a function with non-existent type names.
A warning is generated when loading a function with unbound symbols.
Loading a function will now display any warnings generated.
Fixed a crash on evaluating an empty test.
Added garden-switch-to-session
(bound to C-c C-z
) to switch to the
*garden*
buffer from a garden-mode
buffer.
Goal: User-defined enum types.
Added :forget
, :types
and :uptime
. :doc
now supports types as
well as functions.
Void
has been renamed to Unit
and moved to the prelude.
The function lines()
has been replaced with String::lines
.
Bool
is now an enum defined in the prelude. true
and false
are
no longer reserved words, and boolean values are now True
and False
.
Goal: Red and yellow squiggles.
Added functions: list_directory
and should_equal
.
Added methods: String::join
, String::contains
, String::lines
, List::filter
,
and List::is_empty()
.
Emacs sessions now handle large outputs without crashing.
Goal: Support interactive unit tests.
A local variable or parameter named _
is now always ignored. The
following is now legal:
fun f(_, _) {}
fun g() {
let _ = 1;
let _ = 2;
}
Implemented List::append
, List::get
, List::len
,
String::concat
, String::len
and String::substring
methods,
removing the corresponding list_append
, list_get
, list_len
,
string_concat
, string_length
and `string_substring functions.
Added error()
and string_repr()
functions. Removed int_to_string()
in favour of string_repr()
.
Added :forget_local
and :test
.
Fixed a crash on calling method calls with the wrong arity.
Repeating a parameter is now a parse error.
Goal: Support method calls.
Functions and methods can now specify the return type and parameter types. That type will be enforced at runtime.
Added <=
and >=
comparison operators.
Added parsing and evaluation support for methods.
Symbols may now include uppercase ASCII letters, so Foo
is a legal
function name.
Added :type
to show the type of an expression.
Added :methods
to show all the defined methods available.
Added println
and changed print
to not include a trailing newline.
Goal: Define a real program that solves a problem for me.
Added dbg
, list_get
, list_length
, path_exists
, string_concat
and working_directory
.
Renamed :globals
to :funs
to reflect its current purpose.
Fixed parsing of repeated calls, e.g. f()()
was previously not
permitted.
Added closures, e.g. fun(x, y) { x + y; }
.
If the first line of a file starts with #
, it will be ignored,
enabling use of garden
in a shebang.
main
functions are now always called with one argument, the CLI
arguments that are passed.
Goal: Build up and evaluate blocks of code
Interactive sessions: Added the :search
command for finding
definitions with a given name.
Syntax: if
is now an expression, so the following is legal:
let x = if (y) { 1; } else { 2; };
Syntax: Added support for escaping in string literals, so "\n"
,
"\\"
and "\""
now work correctly.
Syntax: Added list literals, e.g. [1, 2 + 3]
.
Syntax: Added negative int literals, e.g. -123
.
Syntax: ==
and !=
now work for all types.
Syntax: Added block expressions, e.g. { foo(); bar(); }
evaluates
foo()
and returns the value of bar()
.
Syntax: if
and while
now have block scope, so local variables
introduced there are only available until the end of the block.
Standard library: Added the functions list_append
,
string_substring
and string_length
.
Garden executable: Added the run
command, so the following now
works:
$ garden run sample_programs/hello_world.gdn
Commands: :abort
exits out of any blocks as well as functions.
Goal: Basic Emacs integration
Syntax: Added //
comment syntax. Added return
. Allowed if
without else
, as well as else if (...) { ... }
.
Interactive interpreter: added :abort
, :doc
, fstmts
, :replace
,
:resume
, :skip
, :trace
and :quit
commands. :help
can now
show information on what commands do.
Goal: Run FizzBuzz
Syntax: Added if
, while
, assignment, !=
, -
, *
, /
, <
,
>
, ||
and &&
.
Standard library: Added int_to_string
.
Interactive interpreter: added :stack
and :source
commands. Commands can now be run when errors occur.
Goal: Run Hello World
A basic toplevel that supports hello world.