Ticket #1103 (closed deprecation: done)

Opened 5 years ago

Last modified 4 years ago

Optional named parameters must be explicit

Reported by: allison Owned by: nwellnhof
Priority: normal Milestone:
Component: core Version: 1.6.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

In the old implementation of the calling conventions, there was a bug where extra named arguments would not be caught as an error if there were no named parameters in the called sub (even though they would be caught if there was at least one named parameter). This code example demonstrates the problem:

.sub main :main
    'foo'('tene', 'wtf' => 'wtf')
.end

.sub 'foo'
    .param pmc name
    say name
.end

The pcc_reapply branch fixed this bug, but unfortunately PGE was relying on the bug extensively to allow an optional named 'actions' argument to be passed to rules, and silently ignored when no named 'actions' parameter was defined in the rule.

We've inserted a hack in the branch (soon to be merged into trunk), to artificially reproduce the behavior of this bug. The hack will be removed after 2.0, and all optional named parameters will have to be declared in the sub.

Change History

  Changed 5 years ago by coke

  • type changed from cage to deprecated
  • summary changed from [CAGE] Optional named parameters must be explicit to Optional named parameters must be explicit

in reply to: ↑ description   Changed 5 years ago by jkeenan

Replying to allison:

We've inserted a hack in the [pcc_reapply] branch (soon to be merged into trunk), to artificially reproduce the behavior of this bug. The hack will be removed after 2.0, and all optional named parameters will have to be declared in the sub.

Was the pcc_reapply branch merged into trunk?

Was the 'hack' removed after 2.0?

Can we get an update on the status of this ticket?

Thank you very much.

kid51

  Changed 4 years ago by luben

PGE is not yet patched, so the hack is not removed.

  Changed 4 years ago by nwellnhof

  • status changed from new to assigned
  • owner set to nwellnhof
  • component changed from none to core

I made the necessary changes to PGE in 80a776a1d1d, at least to make the tests pass. But I can imagine that switching to the stricter calling conventions will break things in other places.

  Changed 4 years ago by bacek

  • status changed from assigned to closed
  • resolution set to done

Hello.

hack was removed by WHiteknight in a3a8335d226869a76571f7a9bbbeadb43d5c5851. Closing ticket.

-- Bacek

Note: See TracTickets for help on using tickets.