Raku / doc

🦋 Raku documentation
https://docs.raku.org/
Artistic License 2.0
287 stars 293 forks source link

Document `/<foo ...>/` syntax somewhere #1858

Open zoffixznet opened 6 years ago

zoffixznet commented 6 years ago

It's a special syntax that lets users write stuff like their own versions of stuff like <before ...>. (description copied from https://github.com/rakudo/rakudo/issues/1634#issuecomment-374689565)

[…] it is the syntax that lets us parse <before abc> and similar. Unlike with <foo: ...> and <foo(...)>, where the args are parsed by the MAIN language, the <foo ...> form parses the rest of the assertion using the regex language, wraps it in a closure, and passes it to foo. Thus it's a general syntax for higher-order regex operators - which is just what before/after are.

I guess maybe somewhere in the "advanced" section or grammars is a good place to put this. Just to separate it from all the common syntax novice users might be reading through.

JJ commented 6 years ago

Grammars or regexes?

zoffixznet commented 6 years ago

:woman_shrugging:

mryan commented 6 years ago

OK. Had a look at this on and off during the day. A few preliminary points (as I see it - correct where necessary):

So, before I go further, I need to know if

None of these options look all that good to me. I need some advice. Lastly, either this isn't really a "good first issue" or I've got a lot to learn...

JJ commented 6 years ago

You look reasonably on track, but you probably need to show your examples to see how it goes. You can't take away this feature; if it's internal, it should not be documented, but if it's not...

JJ commented 6 years ago

Gist documented what's been done so far here: https://gist.github.com/mryan/dc8c890de862876abc4f87f55d974070 Thanks @mryan

AlexDaniel commented 6 years ago

This looks extremely useful, I'm +1 for adding it. Generally, we should first look if there are any tests in roast for it. If there are, then we document it right away. If not, then we don't…

If there are no tests for it right now, maybe add some? I'm not sure which part of it exactly is implementation-specific…

mryan commented 6 years ago

I've posted a question to stack overflow asking how to use this feature. Need to see how it's used before being able to document how it's used. https://stackoverflow.com/questions/50210456/how-can-i-use-the-perl6-regex-metasyntax-foo-regex

JJ commented 5 years ago

Check out @TimToady 's comment in the IRC https://colabti.org/irclogger/irclogger_log/perl6?date=2018-05-08#l150