What would you prefer to see in the examples, try
or ?
?
# (1)
Stdout.line!? "$(datetime) $(Inspect.toStr req.method) $(req.uri)"
# (2)
try Stdout.line! "$(datetime) $(Inspect.toStr req.method) $(req.uri)"
@Sam Mohr -- do you have any guidance here? Is there a more "future-proof" version?
I expect try will go away, I'd vote for ?
It's not as good now, but it's the parens function call plan
Screenshot 2024-12-16 at 20.34.14.png
It'd be nice if someone could update tree-sitter or the relevant syntax highlighting so the ?
popped a little more
I know @Eli Dowling has been waiting to make updates until after the deluge of syntax changes finishes
But we can probably add an issue to the tree-sitter-roc repo that says we should highlight ! and ? as operators
And then you can assign it to me
I can't promise it'll get done this week, I'm still in choir throes, but it's an easy change IMO
Yeah I can see the value in holding off... but I'm also hoping this is a super minor change. But I have no idea how the tree sitter grammar's a like to update. Or the process to feed that back to zed or the editors
I've done it before
Nothing crazy
If Zed is anything like Helix, you just need to feed it an updated commit SHA for the tree sitter repo
But maybe they use the latest commit by default? :woman_shrugging:
personally I'd prefer try
until we switch to parens-and-commas
the main reason we added try
was to avoid !?
so I'd rather not have !?
in the docs while we still have try
and don't have parens-and-commas yet :big_smile:
Do you think it's important to add HTTP to basic-ssg?
I'm on the fence about adding these effects
Haven't thought much about it though
Like could you imagine using it in this? maybe fetch a json list of something?
main! : Args => Result {} _
main! = \{ inputDir, outputDir } ->
# get the path and url of markdown files in content directory
files = SSG.files!? inputDir
# helper Task to process each file
process_file! = \{ path, relpath, url } ->
inHtml = SSG.parse_markdown!? path
outHtml = transform_file_content url inHtml
SSG.write_file! { outputDir, relpath, content: outHtml }
## process each file
List.forEachTry! files process_file!
transform_file_content : Str, Str -> Str
transform_file_content = \current_url, html_content ->
when List.findFirst nav_links (\{ url } -> url == current_url) is
Ok current_nav_link -> Html.render (view current_nav_link html_content)
Err _ -> crash "unable to find nav link for URL: $(current_url)"
Decided to add it, just in case.
Could be nice for validating links? :shrug:
Last updated: Jul 05 2025 at 12:14 UTC