Ticket #1771 (closed bug: fixed)

Opened 11 years ago

Last modified 11 years ago

Cannot hll_map in parrot HLL

Reported by: whiteknight Owned by:
Priority: normal Milestone:
Component: none Version: 2.6.0
Severity: medium Keywords: HLL
Cc: Language:
Patch status: Platform:

Description

It appears that you cannot use hll_map in the Parrot HLL. This seems like an unnecessary restriction. Is there a particular reason why this is not permitted, or is it simply an oversight?

.sub main
    $P9 = box 4.5
    $S9 = typeof $P9
    # Float. Good
    say $S9

    $P0 = getinterp
    $P1 = typeof $P9
    # Float, good
    say $P1
    $P2 = subclass $P1, ['MyFloat']
    # MyFloat, good
    say $P2
    $P3 = new $P2
    $S0 = typeof $P3
    # MyFloat, good
    say $S0

    $P0.'hll_map'($P1, $P2)

    $P9 = box 5.5
    $S9 = typeof $P9
    # Float. wtf?
    say $S9
.end

Change History

Changed 11 years ago by coke

Here's a slightly shorter example. Just swap out anything for 'parrot' to see the effect.

.HLL 'parrot'

.sub foo :init
    $P0 = getinterp
    $P1 = get_class 'Float'
    $P2 = subclass $P1, ['MyFloat']
    $P0.'hll_map'($P1, $P2)
 .end

 .sub main :main
    $P9 = box 5.5
    $S9 = typeof $P9
    # Float. wtf?
    say $S9
 .end

I don't think this is necessarily a bug, though. I think we can declare the parrot HLL "internal".

What's the use case for supporting this?

Changed 11 years ago by whiteknight

A big part of my frustration is that the hll_map method appears to complete successfully, but silently does nothing. I'm also not sure why the 'parrot' HLL would be semantically different from any other HLL.

Throwing an exception in hll_map if we're in a situation that won't do anything would be better than what we have now (And would resolve this ticket, as far as I am concerned, though wouldn't be as good as the alternative).

The case can be made that this behavior is done for performance reasons. However, I'm not sure I like that argument and I can elaborate on reasons why if necessary.

My current use-case is that NQP-RX does not currently support HLL namespaces, so any program written in that language cannot use HLL maps. This can be fixed in NQP (I'm working on such a patch right now), but doesnt really resolve the issue that this is a very strange special case.

Changed 11 years ago by NotFound

My view is that there is no parrot HLL, is a reserved name with some particular meanings, like accessing the root PMC and library classes or getting a PIR compiler.

Added the exception throwing and a test for it in r48811

Changed 11 years ago by NotFound

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

The issue has been improved, thus closing ticket. If someone has proposals about changing current behavior, please create a new ticket with type RFC.

Note: See TracTickets for help on using tickets.