Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/blockexpr #274

Merged
merged 5 commits into from
Oct 8, 2024
Merged

Refactor/blockexpr #274

merged 5 commits into from
Oct 8, 2024

Conversation

leissa
Copy link
Member

@leissa leissa commented Apr 29, 2024

Plz first give #273 your blessing.

  • removes block expressions: { d* e }.
    simply use d* e instead and if you really want to use delimiters use a tuple: (d* e)
  • abc::(a: A, b: B, c: C) -> (a: A, b: B, c: C)::abc.
    This is simpler to parse and makes more sense as the identifier abc is only available after having processed the whole tuple pattern.

@leissa leissa marked this pull request as ready for review May 1, 2024 23:58
@NeuralCoder3
Copy link
Collaborator

abc::(a: A, b: B, c: C) -> (a: A, b: B, c: C)::abc.

I think this syntax is confusing.
: is used as type annotation. Hence, we used :: as name :: destructor pattern.
Which was okay as it conceptually was somewhat similar to the type pattern.
However, with both swapped, it becomes even less clear.
Furthermore, :: is commonly used for lists or type hints in Haskell.

I think a syntax like as would be clearer.
(a: A, b: B, c: C) as abc means we have the destructured tuple (a,b,c) but also identify the whole expression as abc.

gtest/test.cpp Outdated
EXPECT_EQ(c, r);
// EXPECT_TRUE(r->is_term());
// EXPECT_TRUE(!r->type()->is_term());
// EXPECT_EQ(c, r);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these lines no longer true?

@leissa
Copy link
Member Author

leissa commented May 31, 2024

abc::(a: A, b: B, c: C) -> (a: A, b: B, c: C)::abc.

I think this syntax is confusing. : is used as type annotation. Hence, we used :: as name :: destructor pattern. Which was okay as it conceptually was somewhat similar to the type pattern. However, with both swapped, it becomes even less clear. Furthermore, :: is commonly used for lists or type hints in Haskell.

I think a syntax like as would be clearer. (a: A, b: B, c: C) as abc means we have the destructured tuple (a,b,c) but also identify the whole expression as abc.

I tried as but I think it feels quite clumsy - especially when destructing arguments of a curried function:

.ax %mem.load:  Π .[T: *, .Nat] .as Tas [%mem.M, %mem.Ptr Tas] -> [%mem.M, T], normalize_load;

Any other ideas?

@leissa
Copy link
Member Author

leissa commented Oct 8, 2024

I think I'm merging for now but add an issue for the alias pattern that we want to have a nicer syntax here. After all, we want to rename Thorin and for this reason I don't want to have stale branches lying around ...

@leissa leissa merged commit 2f7eb4d into master Oct 8, 2024
12 checks passed
@leissa leissa deleted the refactor/blockexpr branch October 8, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants