diff options
| -rwxr-xr-x | Justfile | 2 | ||||
| -rwxr-xr-x | build.py3 | 5 | ||||
| -rwxr-xr-x | index.html | 36 | ||||
| -rw-r--r-- | src/blog/named-optional-args.kuht | 27 | ||||
| -rwxr-xr-x | src/index.kuht | 1 |
5 files changed, 20 insertions, 51 deletions
@@ -1,3 +1,3 @@ sync: python3 build.py3 - rsync -azvP 'target/' botahamec@botahamec.dev:/var/www/botahamec.dev + tar -cz 'target/' | ssh botahamec@botahamec.dev tar -C /var/www/botahamec.dev -xz @@ -1,11 +1,11 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- -import brotli import gzip import os import shutil +import brotli + def clean_target(): if os.path.exists('target'): @@ -37,7 +37,6 @@ def compress_files(path: str): compress_files(file) return - base, ext = os.path.splitext(file) with open(file, 'rb') as f_in: data = f_in.read() with gzip.open(f"{file}.gz", 'wb') as f_out: diff --git a/index.html b/index.html deleted file mode 100755 index 0ce371f..0000000 --- a/index.html +++ /dev/null @@ -1,36 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <title>Botahamec's Website</title> - <link href="/style.css" rel="stylesheet" /> - <link href="/style-light.css" rel="stylesheet" title="Default Style" /> - <link href="/style-dark.css" rel="alternate stylesheet" title="Dark Mode" /> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="description" content="All of Bota's projects and endeavors" /> - <meta charset="utf-8" /> - </head> - <body> - <header><h1>Botahamec</h1></header> - - <p> - Hi. This is a website I threw together quickly so that I could write my blog post. It's not - much right now. But you should read my blog posts anyway. - </p> - - <h2>Projects</h2> - <ul> - <li><a href="https://www.github.com/botahamec/happylock">HappyLock</a></li> - <li><a href="https://www.github.com/botahamec/exun">Exun</a></li> - <li><a href="https://www.github.com/botahamec/snob">Snob</a></li> - </ul> - - <h2>Blog</h2> - <ul> - <li><a href="/blog/how-happylock-works.html">How HappyLock Works</a></li> - <li><a href="/blog/best-tool-for-the-job.html">The Best Tool for the Job</a></li> - <li><a href="/blog/an-inheritance-detox.html">An Inheritance Detox</a></li> - <li><a href="/blog/try-catch-in-rust.html">Introducing try-catch to Rust</a></li> - <li><a href="/blog/comments-at-end.html">Comments at the End</a></li> - </ul> - </body> -</html> diff --git a/src/blog/named-optional-args.kuht b/src/blog/named-optional-args.kuht index 7d36972..874ea57 100644 --- a/src/blog/named-optional-args.kuht +++ b/src/blog/named-optional-args.kuht @@ -654,7 +654,7 @@ split("hello world", .at = ' ', .limit = 2, .case_sensitive = true); will satisfy as many people as possible. I'll monitor the comments anywhere this gets posted to see if there are any major criticisms. I can't guarantee that I'll actually make an RFC, but permission is granted to create an RFC if - I don't. I think it's been a while since named argument were last seriously + I don't. I think it's been a while since named arguments were last seriously proposed, so I think now is a good time for a new proposal. </p> @@ -991,8 +991,7 @@ trait Trait { impl Trait for () { // This is okay, because the parameter names match - // unused parameter warnings can be ignored using @ - fn f(pub a: i32, pub b @ _: i32) {} + fn f(pub a: i32, pub b: i32) {} } impl Trait for i32 { @@ -1079,7 +1078,7 @@ CallParams = CallParam ( "," CallParam )* ","? FunctionParamPattern = "pub" pat:IdentifierPattern ":" ( ty:Type | "..." ) ( "=" expr:Expr ) </pre> -<p>similar rules to the rules for default field values apply. Namely,</p> +<p>Similar rules to the rules for default field values apply. Namely,</p> <ul> <li> If the function is <code>const</code>, then the expression, <code>expr</code> @@ -1114,11 +1113,7 @@ foo::<T>(); placed on a <code>FunctionParam</code>, it also applies to the expression, <code>expr</code>. </li> - <li> - Unused parameter names will not emit a warning if they are bound to a - different pattern using <code>@</code>. The bound pattern may still emit a - warning - </li> + <li>Unused parameter names will not emit a warning.</li> </ul> <p> @@ -1253,8 +1248,8 @@ coordinates(y, x); <p> Although many languages, such as Kotlin and C#, allow any argument to be - named, this is not practical for Rust. Changing an argument is currently not - a breaking change, but would become one as soon as named arguments are + named, this is not practical for Rust. Changing an argument name is currently + not a breaking change, but would become one as soon as named arguments are introduced. The solution is to allow authors to decide if their argument names are an implementation detail or not. </p> @@ -1518,6 +1513,16 @@ enableFlags(bold: true) <h3>Future possibilities</h3> +<h4>Default parameter values for non-public parameters</h4> + +<p> + In this proposal, only public parameters can have default values. Optional + named parameters are much more flexible than optional positional parameters, + but many languages do still support optional positional arguments. It's not + hard to imagine extending this proposal to positional arguments, although the + use-case would be more limited. +</p> + <h4>Default parameter values for trait methods</h4> <p> diff --git a/src/index.kuht b/src/index.kuht index 89e15d3..e5ae437 100755 --- a/src/index.kuht +++ b/src/index.kuht @@ -30,5 +30,6 @@ <li><a href="/blog/datetime.html">Comparing Date Types Across Languages</a></li> <li><a href="/blog/color-spaces.html">Color Spaces</a></li> <li><a href="/blog/git-plugins.html">Make Yourself Some Git Plugins</a></li> + <li><a href="/blog/named-optional-args.html">Named and Optional Arguments are Awesome</a></li> </ul> </body> |
