added: release 0.1.4 page
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 23 Jun 2023 03:21:03 +0000 (22:21 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 23 Jun 2023 03:21:03 +0000 (22:21 -0500)
onyx-pkg.ini
src/app.onyx
www/news-articles/index.json
www/news-articles/release-0.1.4.html [new file with mode: 0644]

index f874f68ec4155dddcf660428359b1e981871c10e..e6a7bc9727ed42cb7d832324b991c22ec2773b95 100644 (file)
@@ -10,15 +10,12 @@ lib_source_directory=./lib
 lib_bin_directory=./bin
 run_cmd=onyx run build
 debug_cmd=onyx run --debug build
-test_cmd=
 
 [native_library]
-build_cmd=
-library=
 
 [dependencies]
-git://onyxlang.io/repo/http-server=0.2.8
-git://onyxlang.io/repo/otmp=0.0.14
+git://onyxlang.io/repo/http-server=0.2.10
+git://onyxlang.io/repo/otmp=0.0.16
 
 [dependency_folders]
 git://onyxlang.io/repo/http-server=http-server
index 5a2a8e0aa918be8dd2a3dfbe0bad6f7f2172d88f..0bde6680ab9fe1f12949f84daf3e4f019b96f0d2 100644 (file)
@@ -48,7 +48,8 @@ news_articles: Cached_Resource([] Article);
 
 @route.{.GET, "/news/:article"}
 (req: &Req, res: &Res) {
-    article := array.first(news_articles->get() ?? .[], [n](n.path == req.url_params["article"]));
+    article_path := req.url_params["article"] ?? "";
+    article := array.first(news_articles->get() ?? .[], [n](n.path == article_path));
     if !article {
         res->status(404);
         res->render("pages/404", null);
index 955b11131f5c0afa8ad2e156ad58c1e96eecfc0d..bec20b71fbae8a31a867e46e1884e532e51f1610 100644 (file)
@@ -1,4 +1,10 @@
 [
+    {
+        "name": "Beta Release 0.1.4",
+        "path": "release-0.1.4",
+        "date": "22nd June 2023",
+        "description": "Onyx's beta 0.1.4 release"
+    },
     {
         "name": "Beta Release 0.1.3",
         "path": "release-0.1.3",
diff --git a/www/news-articles/release-0.1.4.html b/www/news-articles/release-0.1.4.html
new file mode 100644 (file)
index 0000000..01bc1a4
--- /dev/null
@@ -0,0 +1,91 @@
+<h1>Beta Release 0.1.4</h1>
+
+<p>
+This is a small release that brings a <strong>big breaking change</strong> to most Onyx programs.
+In short, <code>map.get</code> now returns an <em>Optional</em>, instead of the value directly.
+This leads to cleaner and more understandable code.
+</p>
+
+<p>
+The Onyx package manager also sees a small update in the outputted library directory when packages are synchronized.
+Assuming you are using the provided <code>packages.onyx</code> file, this should be a transparent change.
+</p>
+
+<h2>Map uses Optional</h2>
+
+<p>
+The <code>map.get</code> procedure is now defined like so:
+</p>
+
+<pre class="hljs"><code class="language-onyx">Map.get :: (m: &Map($K, $V), k: K) -> ? V { ... }</code></pre>
+
+<p>
+This is more idiomatic as now the procedure can actually return "no result", without returning a dummy default value.
+However, as <code>Map</code> is a core data structure used by many programs, this will break many programs.
+This is why this release is smaller than most, as I want to get this change out there.
+All libraries have been updated for this already.
+</p>
+
+<p>
+To convert existing code, you will likely just need to add <code>?? .{}</code> after the <code>map.get</code> or <code>m[key]</code>.
+This will provide a default value if <code>None</code> was returned.
+</p>
+
+<p>
+A useful pattern I found myself using while converting the standard library was this:
+</p>
+
+<pre class="hljs"><code class="language-onyx">
+m: Map(str, str);
+// ...
+m->get("some key")->with([the_value] {
+    // Do something with "the_value"
+    println(the_value);
+});
+</code></pre>
+
+<p>
+The code inside of the <code>with</code> block is only executed if the value was present, so this acts like a <code>map.has</code> and <code>map.get</code> all at once.
+</p>
+
+<h2>Onyx package folder structure</h2>
+
+<p>
+In this version of Onyx, the package manager no longer outputs a flat directory structure for the included packages.
+Instead, the <em>full path</em> to the package is used.
+</p>
+
+<p>
+For example, if you include <code>https://github.com/someuser/somepackage</code>, then the path to that library will be <code>./lib/github.com/someuser/somepackage</code>.
+This way, package names do not have to be unique across the Onyx ecosystem, as this is impossible to enforce as Onyx does not have a centralized package version manager.
+</p>
+
+<p>
+This change should be transparent so long as you are using the <code>./lib/packages.onyx</code> file.
+The next time you run <code>onyx package sync</code> this new folder structure will be created and switched to.
+</p>
+
+<h2>Full Changelog</h2>
+<pre>
+Release v0.1.4
+-----------
+22nd June 2023
+
+Additions:
+
+Removals:
+- Deprecated `map.get_opt`.
+    - This is unnecessary with the new semantics of `map.get`.
+
+Changes:
+- `onyx pkg` now stores synchronized packages in a different folder hierarchy.
+    - This is a transparent change so long as you use the `lib/packages.onyx` file.
+- `Map` implementation no longer holds a default value. Instead, it returns an optional from `map.get`.
+    - This is a significant breaking change that will affect many programs.
+
+Bugfixes:
+- Fixed a bug that made relative imports not always relative to the current file.
+    - This may break some programs that were accidentally using this "feature".
+- Fixed a bug with small a `union` over small data types, such as booleans.
+    - There was an alignment issue, which caused the union to be smaller than expected.
+</pre>