{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/d1588981e0248aaa0174906c99df180e?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"d1588981e0248aaa0174906c99df180e","url":"https://api.github.com/users/petdance","login":"petdance","id":41100},"assignee":null,"updated_at":"2011-11-14T05:55:25Z","labels":[{"name":"core","color":"A37D9A","url":"https://api.github.com/repos/petdance/scratch/labels/core"},{"name":"Pri-normal","color":"64C2DA","url":"https://api.github.com/repos/petdance/scratch/labels/Pri-normal"},{"name":"rfc","color":"0CF239","url":"https://api.github.com/repos/petdance/scratch/labels/rfc"},{"name":"Sev-medium","color":"8F0079","url":"https://api.github.com/repos/petdance/scratch/labels/Sev-medium"}],"closed_at":null,"comments":0,"url":"https://api.github.com/repos/petdance/scratch/issues/244","body":"the get_integer and get_number VTABLEs are limited because they return a particular numeric type without any indication for the preference of the PMC. For instance, some PMCs may prefer to be treated as an integer value or as a floating point value for mathematical calculations. Also, it is nonsensical to ask certain PMCs for a floating-point value or to ask other types for an integral value.\nIf you look at a code example from an HLL like this:\r\n{{{\r\n$c = $a + $b\r\n}}}\r\nit is difficult to know how to treat the operation and whether to store an int-like or float-like value in $c. This is especially true when considering types that aren't typically used in equations, such as array types. When treated as a number, should ResizablePMCArray act like a float or an int? For example NQP treats all mathematic operations as float-point and requests values from PMCs accordingly. \r\n\r\nI would like to suggest the creation of a get_numeric_pmc VTABLE that would return a numeric PMC type that can be used as a stand-in for a non-numeric type in calculations and preserve information about whether the type should be treated as a float or an int. An RPA could return an Integer PMC as we expect, but other types that prefer it could return Float, BigInt, BigNum, or even Complex types as required. In this way we could get proper information about the use of a PMC in a mathematical context without having to shoehorn unnecessary and nonsensical get_number and get_integer vtables into all our types, an without requiring Parrot to make decisions about type conversion or type promotion. The HLLs should handle those kinds of decisions without Parrot making defaults.\r\n\r\nIn additon to the new VTABLE we would likely need a new opcode to expose it.\r\n\r\nOriginally http://trac.parrot.org/parrot/ticket/1470","html_url":"https://github.com/petdance/scratch/issues/244","title":"Create a get_numeric_pmc VTABLE","number":244,"id":2225588,"created_at":"2011-11-14T05:55:25Z"},"action":"opened"}