AnyDSL / MimIR

MimIR is my Intermediate Representation
https://anydsl.github.io/MimIR/
MIT License
46 stars 9 forks source link

Refactor/blockexpr #274

Closed leissa closed 1 week ago

leissa commented 5 months ago

Plz first give #273 your blessing.

NeuralCoder3 commented 5 months ago

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.

leissa commented 4 months ago

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 commented 1 week ago

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 ...