Skip to content

Is it possible to implement UFCS with rhombus' macro system? #340

Answered by usaoc
glyh asked this question in Q&A
Discussion options

You must be logged in to vote

I don’t know if you have already figured this out yourself, but basically it depends on how complicated you want it to be. The limitation is that the left-hand side of . will always be a parsed expression, but the right-hand side can be something unparsed. A really dumb version:

#lang rhombus/and_meta
expr.macro '$left . $fn ($arg, ...)':
  '$fn #%call ($left, $arg, ...)'

This is dumb, because the expression following . has to be a term, but I think UFCS already has this limitation anyway.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by glyh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants