#1445: Add ResizableStringArray.get_number VTABLE function
-----------------------------+----------------------------------------------
Reporter: Austin_Hastings | Owner:
Type: todo | Status: new
Priority: normal | Milestone:
Component: none | Version: 2.0.0
Severity: medium | Keywords: rsa, ResizableStringArray,
get_number, NQP
Lang: | Patch:
Platform: |
-----------------------------+----------------------------------------------
Comment(by pmichaud):
A thought as I was heading out to lunch...
Turning this thread around a bit -- while it might seem nonsensical for a
caller to ask an Array for a floating point value, I suppose one could
argue that it's equally nonsensical for an Array to refuse to provide a
floating point value if asked, given that it's perfectly willing to
provide an integer value (and integers are subsets of floats).
This comment is not at all intended to detract from any of the points or
suggestions made above -- I'm just observing that for many of our existing
PMC types that are able to respond to get_integer requests, it's perhaps
unreasonable for the PMC to also say "...but I won't give you a float if
you ask for one of those." In the few cases (I can't think of any) where
returning a float might be incorrect or misleading, then throwing an
exception makes perfect sense. But I wouldn't want to see Parrot imposing
an interpretation that things that tend to be integer-like won't also act
as floats when explicitly asked to do so.
Bottom line: In addition to the get_number_pmc proposed above, I think we
should also do what this ticket asks, and add get_number vtable entries to
the PMCs that provide get_integer (and where it makes sense to do so). We
already do this for a number of the array PMC types -- let's just make it
consistent all the way through (and hopefully this comment provides a
justification for doing so).
Pm
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1445#comment:6>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets