rhombus-prototype icon indicating copy to clipboard operation
rhombus-prototype copied to clipboard

RFC: C-expressions

Open jeapostrophe opened this issue 6 years ago • 13 comments

This RFC attempts to define some concrete syntax for Racket2 in response to issue #3

It is draft and I expect there are some big things that need to be updated, as well as medium things (like better explanations) and small things (like typos).

Please check it out and comment!

The easiest way to read the RFC is at this link.

jeapostrophe avatar Jul 26 '19 01:07 jeapostrophe

In line 199 you are using ' instead of `.

Also it needs something like "and so on".

gus-massa avatar Jul 26 '19 02:07 gus-massa

Thanks @gus-massa

jeapostrophe avatar Jul 26 '19 02:07 jeapostrophe

Overall impression: I like this approach, but I've been assuming there would be an RFC discussing what we want out of an alternative syntax before any proposals for one. @jeapostrophe, were you intending to write something like that as well?

jackfirth avatar Jul 26 '19 05:07 jackfirth

I don't intend to write an RFC about wants. I see some value in that, but I don't know how write it. I think these conversations about wants on the list and issues are valuably fluid. I think that everyone's reactions to some concrete proposal will expose more understanding of wants than just thinking about wants themselves. I'd really like to see someone else come up with an alternative or explain some want that this doesn't fulfill and we can look for ways to improve both and reach a new plateau.

jeapostrophe avatar Jul 26 '19 10:07 jeapostrophe

The function and macro examples don't have a ; after the body. Was there meant to be one, or have I misunderstood the grammar/intent?

mflatt avatar Jul 26 '19 15:07 mflatt

@mflatt That was a typo, I just pushed a fixed.

jeapostrophe avatar Jul 26 '19 15:07 jeapostrophe

This is slightly related, but one thing I haven't really understood is why the macro name has to be at the front of an expression. For example, why couldn't you do something like tell the expander to look for the pattern (a and b) and replace it with (and a b). Could this restriction be lifted in something like c expressions? Sorry if it's a stupid question.

zlee-personal avatar Jul 30 '19 23:07 zlee-personal

@vityou You need to have a consistent rule to know that the macro is and rather than a in your example.

jeapostrophe avatar Aug 03 '19 17:08 jeapostrophe

@jeapostrophe wouldn't the expander be able to figure that out similarly to how it knows if an something is a function rather than a macro? Why wouldn't it work so that once the expander encounters a macro, like and that it gives the entire expression (a and b) to and?

zlee-personal avatar Aug 03 '19 19:08 zlee-personal

@vityou You're saying that when the expander sees a ( it gives control to the first macro that it sees, wherever it is? So (+ 1 a) is a macro invocation if a happens to be bound to a macro in that block. I think that is possible but I don't like it :)

jeapostrophe avatar Aug 03 '19 20:08 jeapostrophe

@jeapostrophe I thought it may be helpful if we're moving to a more infix friendly syntax, however I probably haven't figured out all the drawbacks. What problems do you see with it?

zlee-personal avatar Aug 03 '19 21:08 zlee-personal

Something I think might be beautiful would be a rule like that for situations where you have sequence of tokens but NOT when you have a infix operator (1 + 1) or a function call (f(x, y) --- doesn't depend on whether x or y is bound to a macro.)

jeapostrophe avatar Aug 03 '19 21:08 jeapostrophe

I'm opening this to make it more visible for history pre RacketCon

jeapostrophe avatar Sep 22 '21 15:09 jeapostrophe