# New Ticket Created by  "Christoph Otto (Volt)" 
# Please include the string:  [perl #52478]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=52478 >


When running the following PIR code, Parrot does the Perlish thing and 
implicitly converts s to an int.  This violates the principle of least surprise 
and makes it unnecessarily difficult to test whether an element exists within 
an array.  It would be much more logical if the array-like PMCs threw an 
exception in this circumstance.

.sub _main
    .local pmc a
    .local string s
    a = new 'ResizablePMCArray'
    a['foo'] = 'stuff'
    s = a['bar']
    print s #prints 'stuff'
    s = a[0]
    print s #prints 'stuff'
    print "\n"
.end

Reply via email to