-
Notifications
You must be signed in to change notification settings - Fork 14
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
Implement simple syntax macros #80
Comments
"In general, each node (tuple) above follows the following format:" { tuple | atom, list, list | atom }
Besides the node defined above, there are also five Elixir literals that when quoted return themselves (and not a tuple). They are: :sum #=> Atoms
1.0 #=> Numbers
[1,2] #=> Lists
"binaries" #=> Strings
{key, value} #=> Tuples with two elements With those basic structures in mind, we are ready to define our own macro. |
Though Elixir has several constructs that are not definable with a macro. (like if) |
Yes, the "three" here seems mostly coincidental. 007's three in this case are
whereas Elixir's three are something more like
Elixir's message seems to be "this is the internal representation of expression nodes (which is essential to know about if you get into the macro game", whereas this issue is aiming for "we recognize that people tend to want to implement special forms (such as |
Well, the thing is that elixir will parse the |
I no longer believe this to be a good idea. It'd end up being a "wrong default" that we would then have to painstakingly major-version away. Instead, I've started believing that So, blocking this one on #177 for now. |
Well, in a sort of graceful multi-year oscillation, I no longer believe this to be a bad idea. 😄 But maybe the syntax should be modified slightly:
I changed two things from the OP, by the way:
|
Let's try to make a dent in syntax macros as envisioned here. By implementing this bit, 007 would have something macro-wise that Perl 6 definitely doesn't have yet!
I was struck today by how most of the common control statement forms —
if
,for
,while
— are all of the same form:<sym> <EXPR> <pblock>
. So let's make that the default form (for now), until we figure out what we wantis parsed
to be.Mandatory example:
If we can make that work, then that's a pretty sweet start.
Immediate remarks, though:
@ Q::Statement
qualifier is absolutely necessary there. But I put it in because I am not sure.The text was updated successfully, but these errors were encountered: