Choosing "pinning" and "access" operators

How do y’all feel about the following syntax/operators?

My Opinion

Access

:: chooses an option from a custom type:

scoop::chocolate
. scoop :
  #vanilla
  #chocolate
  #strawberry

:: also grabs a member of a record:

r::a . r = { a = 1, b = "x" }

The “hashtag” syntax seems much pretty intuitive for tagged unions.

I personally love the symmetry between :: and #. Feel the power of squares!

From there, I feel like :: extends nicely to records. Obviously conventional periods (e.g. r.a) would be nicer, but we want to reserve that for “where” statements.

Pinning

@ pins a specific version of a scrap, so that it doesn’t fetch the latest one from the scrapyard:

taylor/example@11

I like how this feels like npm install package@1.0.0

Max’s Opinion

@max made a good argument for instead using @ to access records:

I’ll comment a little more later (probably in depth after next Monday; away this weekend) but my surface-level comment is:

This is kind of a major syntax change. I think @ is better suited for indexing (even is “at” in English) than :: is. Is there another char we can use for pinning? Perhaps ~? I think this language change should also be pulled out of this PR and discussed separately

Your Opinion

Thoughts?

1 Like