Stream: compiler development

Topic: where clause syntax


view this post on Zulip Luke Boswell (Jul 03 2025 at 03:11):

I've dug bath through zulip and put together the following examples which show the usage of where clause.

https://gist.github.com/lukewilliamboswell/8aab3d62da2859b7dedbbe69fe0a895f

@Richard Feldman can you confirm this is the inteded syntax and I haven't missed anything.

I'll add snapshots for these to help us implement it later.

view this post on Zulip Anthony Bullard (Jul 03 2025 at 03:12):

i've implemented the parsing of these

view this post on Zulip Luke Boswell (Jul 03 2025 at 03:12):

I wasn't sure if we wanted module(a) every time, or only in the special case where you are referring to a return type.

view this post on Zulip Anthony Bullard (Jul 03 2025 at 03:12):

do you mean for can?

view this post on Zulip Luke Boswell (Jul 03 2025 at 03:13):

Anthony Bullard said:

i've implemented the parsing of these

Oh cool!

view this post on Zulip Anthony Bullard (Jul 03 2025 at 03:13):

you should find at least one snapshot that contains them

view this post on Zulip Luke Boswell (Jul 03 2025 at 03:13):

I was thinking more about the semantics than just parsing the syntax tbh

view this post on Zulip Luke Boswell (Jul 03 2025 at 03:15):

Looks like I missed the where a.Decode use case -- where you can just point to a type declared in that module. We support an Alias with where clauses to make something like Eq etc.

view this post on Zulip Luke Boswell (Jul 03 2025 at 03:15):

Hash(a) : a
    where
        a.hash(hasher) -> hasher,
        hasher.Hasher,

view this post on Zulip Luke Boswell (Jul 03 2025 at 03:17):

I've got enough here then already to build out some more snapshots then. And possibly start implementing in Can also.


Last updated: Jul 06 2025 at 12:14 UTC