3 ms·
var search result = users. find all by name (name); if (search result. is present()) { return ok(search result. get()); } else return not found();
by ivan_gammel 2y ago
var search result = users. find all by name (name);
if (search result. is present()) {
return ok(search result. get());
} else return not found();
It’s weird and syntax highlighting is absolutely necessary to read this.
- ReleaseCandidat 2y agoUsing something else than a dot is better, same as using a slightly different syntax: search result := users @ find all by name (name) if search result @ is present() { return ok(search result @ get()) } else { return not found() }
- navane 2y agoI still think the space adds more readability than the dot dectracts. If you don't like the dot though, I would use a comma. We have been writing for a couple centuries now, and the comma is well known and used. search result := users, find all by name (name) if search result, is present() { return ok(search result, get()) } else { return not found() }
- ReleaseCandidat 2y agoI have to confess I rather like that comma!
- navane 2y agoThen we could use . instead of ; for line endings, and we're almost writing prose :)
- ivan_gammel 2y agoFew more improvements: // comma is optional, used for disambiguation search result := users, find all by name. // omitted parameters match words if search result is present, // empty brackets can be omitted return ok(search result value); // API change for better readability else return: not found. // colon is another optional delimiter I actually like it so much, I would try to write a transpiler to Java…