Ticket #891 (closed todo: fixed)

Opened 12 years ago

Last modified 11 years ago

[TODO] allow spaces in nci function signatures

Reported by: particle Owned by:
Priority: normal Milestone:
Component: core Version: 1.4.0
Severity: low Keywords:
Cc: Language:
Patch status: Platform:


currently, nci function signatures require all symbols to be contiguous. for example, a call like

result = Parrot_call_sub_ret_int(interp, sub, "II", 5);

does not allow the symbols "II" to be separated by whitespace. whitespace allows increased clarity, for example splitting the return value from the parameters.

successful implementation of this feature includes updates to PDD16, and a patch to the NCI subsystem.

Change History

Changed 12 years ago by whiteknight

might I suggest that if clarity if what we're after without changing the fundamentals behind the signature strings, then we should use the PCC "->" style signatures instead? This has the benefit of allowing us to increase clarity and also reuse existing signature parsing logic that we already have available (although probably needs cleanup and proper encapsulation).

Changed 12 years ago by NotFound

If you want clarity at the C level, just use the C language resources:

result = Parrot_call_sub_ret_int(interp, sub, "I" "I", 5);

Or even:

result = Parrot_call_sub_ret_int(interp, sub, "I" /* <- */ "I", 5);

Or use a macro SIGNATURE(ret_type, args) or something like that. All of this is parsed during C compiling, without any runtime penalty.

Changed 12 years ago by jhorwitz

I agree w/ whiteknight's comment. I'd rather be consistent in our interface and improve the documentation, which might have prevented the mistake in the first place. As NotFound mentioned, there are plenty of ways in C to make things self-documenting if you want to go that route.

Changed 12 years ago by particle

the current (draft) documentation is quite clear:

In I<no> case should the signature symbols be separated by whitespace. This
restriction may be lifted in the future, but for now remains as an avenue
for adding additional functionality.

i have only ticketed that note from the docs. obviously, the documentation didn't prevent the user's error that prompted me to create this ticket, however i can't speak to the reason.

Changed 12 years ago by jhorwitz

Ah, good to see that there. As an embedder, I wouldn't have looked there, so it probably makes sense to reference or duplicate that info in PDD10 and embed.pod.

Changed 12 years ago by NotFound

Please don't duplicate information, is hard to make sure it is maintained in sync.

Changed 12 years ago by allison

With the PCC refactor, Parrot_call_sub_ret_int and relatives are being replaced with functions that use the PCC-style signatures with "->" separating the arguments from return values. Agreed on not introducing spaces when we already have a way of marking the separation.

NCI may eventually move to that style of separator too (the hold-up is that PCC doesn't support all the options needed by NCI yet).

Changed 11 years ago by cotto

  • status changed from new to closed
  • resolution set to fixed

added in f9c7b11. Unless I'm missing something, there was way too much discussion for such a trivial change.

Note: See TracTickets for help on using tickets.