Stream: API design

Topic: import syntax


view this post on Zulip drew (May 09 2024 at 14:04):

The new import syntax is :chefkiss:, nicely done.

view this post on Zulip drew (May 09 2024 at 14:04):

i still can't wait for this example to work, but hey at least i learned about the new syntax! https://github.com/roc-lang/roc/blob/main/examples/cli/argsBROKEN.roc

view this post on Zulip drew (May 09 2024 at 14:05):

also, great job updating the platform links in the example repo to the full urls, that's really helpful for new users

view this post on Zulip drew (May 09 2024 at 14:05):

that, plus the ! syntax, and these examples are looking really nice

view this post on Zulip drew (May 09 2024 at 14:08):

have you considered adding exposing to the app header as well, for symmetry? something like app exposing [main] with {...}? I'm sure the answer is "yes" and it's annoying to make any changes now, but just figured i'd ask

view this post on Zulip Agus Zubiaga (May 09 2024 at 14:18):

We wanted to make all the headers more lightweight and use less keywords. The app module syntax is meant to match that of the new module syntax with the list of exposed/provided values right after the header type keyword.

module [ExposedType, exposedFn]

# with module params
module {param1, param2} -> ExposedType, exposedFn]

view this post on Zulip drew (May 09 2024 at 14:18):

ah, nice, thanks

view this post on Zulip Agus Zubiaga (May 09 2024 at 15:20):

drew said:

i still can't wait for this example to work, but hey at least i learned about the new syntax! https://github.com/roc-lang/roc/blob/main/examples/cli/argsBROKEN.roc

@drew You might be interested on @Sam Mohr's Weaver package: https://github.com/smores56/weaver

view this post on Zulip drew (May 09 2024 at 15:22):

ooo awesome

view this post on Zulip drew (May 09 2024 at 15:22):

that is indeed exactly what i want

view this post on Zulip drew (May 09 2024 at 15:23):

though i'm still confused why the stdlib (which has a very nice API btw) segfaults and this works

view this post on Zulip drew (May 09 2024 at 15:23):

i'm guessing the package somehow works around the current limitation?

view this post on Zulip Agus Zubiaga (May 09 2024 at 15:51):

Yeah, that "error in alias analysis" bug is a little unpredictable.

view this post on Zulip Agus Zubiaga (May 09 2024 at 15:52):

I'm sure it's predictable by people smarter than me, but Weaver doesn't seem to run into it :smiley:


Last updated: Jul 06 2025 at 12:14 UTC