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

Migrate to Expronicon.jl v0.8 from Unityper.jl #611

Open
YingboMa opened this issue Jun 12, 2024 · 8 comments · May be fixed by #617
Open

Migrate to Expronicon.jl v0.8 from Unityper.jl #611

YingboMa opened this issue Jun 12, 2024 · 8 comments · May be fixed by #617
Assignees

Comments

@YingboMa
Copy link
Member

Unityper.jl doesn't support recursive type and it also doesn't support powerful pattern matching with MLStyle.jl.

Note that we have to use Expronicon.jl v0.8 and not any other release because later version cause massive invalidations.

CC: @Roger-luo

@Roger-luo
Copy link

Well I do realize it's a bad idea overloading getproperty to provide namespace syntax. So I'm still working on a refactor of Expronicon sum type. I have a working version inside Liang.jl but still WIP splitting that out and stabilizing.

@bowenszhu
Copy link
Member

I'm running into an issue with using parametric types like BasicSymbolic{T} with Expronicon v0.10.8. It seems that Expronicon doesn't yet support them, as demonstrated by the following error:

module SymbolicADT
using Expronicon.ADT: @adt

@adt BasicSymbolic{T} begin end

end # module

Error:

ERROR: LoadError: ArgumentError: generic ADT is not supported yet
...

Is there a workaround for this, or is support for parametric types planned for a future release?

Thanks!

@Roger-luo
Copy link

Yes it doesn't support such for the same reason as Unityper - if we obey C tagged union convention this will require Julia compiler to support generated struct (as pointed out in a previous discussion under JuliaLang/julia)

However, Mason have demonstrated that without this convention we can achieve better performance by just using julia's Union type in SumTypes.jl. I'm planning to adopt this solution and rewrite MLStyle on top of this. The new package is named Moshi.jl stands for the name pattern in Chinese.

But as you may know I just graduated recently so I will be in vacation and moving for the summer. So I'm not sure how much time I have to push this forward this year.

@bowenszhu
Copy link
Member

@YingboMa
Do you have any recommendations on how to handle parametric types with Expronicon for the time being?

@YingboMa
Copy link
Member Author

Since T in Symbolic{T} is only a tag for for symtype. We could just do

struct BasicSymbolic{T}
    x::BasicSymbolicImpl
end

and use Expronicon to implement BasicSymbolicImpl.

@bowenszhu
Copy link
Member

@YingboMa
Thanks for the suggestion! That's a smart workaround for the parametric type limitation.

@bowenszhu bowenszhu linked a pull request Jun 18, 2024 that will close this issue
@bowenszhu bowenszhu linked a pull request Jun 18, 2024 that will close this issue
@Roger-luo
Copy link

Roger-luo commented Jul 11, 2024

Ok well, good but maybe also bad news: I got bored with vacationing and decided to code up this. I just released a version of Moshi.jl with new pattern matching and ADT support (with generics) and should have no invalidation anymore. The interface will be a bit breaking in order to fix the invalidation issue.

And bonus is now many methods are generated by derive macro optional upon your choice instead of automatically (e.g equivalence and show). It's still experimental and in early stages but please feel free to try it out!

@akirakyle
Copy link

I spent this last weekend playing around with migrating to Moshi.jl and that WIP is at #676

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 a pull request may close this issue.

4 participants