Ticket #1518 (closed bug: invalid)

Opened 4 years ago

Last modified 3 years ago

NQP-rx generates wrong twigil for contextual lookups

Reported by: Austin_Hastings Owned by: pmichaud
Priority: normal Milestone:
Component: nqp Version: 2.2.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

Trying to use $*..., I get two behaviors depending on the presence or absence of a namespace. I suspect that the '*' isn't being carried from the front of the namespace to the identifier name in the more-complex case:

$*Kakapo::Filesystem;
say("-----");
$*Filesystem;
.sub "_block11"  :anon :subid("10_1268905264.09348")
.annotate "line", 1
    find_dynamic_lex $P13, "$Filesystem"
    unless_null $P13, vivify_11
    get_hll_global $P13, "$Kakapo::Filesystem"
    unless_null $P13, vivify_12
    die "Contextual $*Kakapo::Filesystem not found"
  vivify_12:
    store_dynamic_lex "$Filesystem", $P13
  vivify_11:
.annotate "line", 2
    "say"("-----")
    find_dynamic_lex $P14, "$*Filesystem"
    unless_null $P14, vivify_13
    get_hll_global $P14, "$Filesystem"
    unless_null $P14, vivify_14
    die "Contextual $*Filesystem not found"
  vivify_14:
  vivify_13:
.annotate "line", 1
    .return ($P14)
.end

Change History

Changed 3 years ago by pmichaud

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

Contextuals (now "dynamic variables") are always lexically scoped and not associated with a namespace. Something like $*Kakapo::Filesystem should probably throw an exception of some sort.

If it's still important to fix, file an nqp-rx issue. Thanks!

Pm

Note: See TracTickets for help on using tickets.