Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Q on Calling conventions; parameter order

6 views
Skip to first unread message

Klaas-Jan Stol

unread,
Feb 5, 2007, 8:15:14 AM2/5/07
to perl6-i...@perl.org
hello,

Some details of the Parrot calling conventions are a bit unclear. For
the languages/PIR parser implementation, I'd like to check on this
order, instead of postponing the check this in a later phase. My guess
is that the actual checking for mismatches is done in Parrot during
runtime, but I'm not sure about that(i.e. throwing exceptions on
mismatches)
After experimenting a bit and some common sense, I came up with the
following order, which I'd like to check with experienced PIR programmers.

1. (Positional, non-optional parameters)*
2. (optional positional parameters)*
3. (slurpy parameter)? # need not be optional, it just takes whatever is
left up till the named parameters
4. (named parameters, either optional or not)*
5. (slurpy named parameter, may be optional)? # :optional flag makes
sense here, it may not be passed.

If people see cases that are not listed here, comments are most
certainly welcome!

Furthermore, I found that using the :named flag without identifier (like
:named('x') ) does not work, or better, is undefined. Shouldn't the
identifier be obligatory?

This weekend, I added docs/pirgrammar.pod to languages/PIR. This
document describes the PIR grammar according to languages/PIR in a more
readable format than the PGE input file (some rules are simplified and
the error handling is removed). It now also contains example code to
explain the formal rules, because reading a formal grammar description
may be too hard for newcomers. In order to explain the calling
conventions, I think being very clear on this point is important to get
new users started easily. IMHO, PDD03 has some gaps here and there.

kind regards,
klaas-jan

0 new messages