#452: [TODO] Don't use MULTI when not needed
---------------------+------------------------------------------------------
Reporter: allison | Owner:
Type: todo | Status: new
Priority: normal | Milestone: 1.4
Component: none | Version:
Severity: medium | Keywords:
Lang: | Patch:
Platform: |
---------------------+------------------------------------------------------
Most (perhaps all) of the current core PMCs don't really use multiple
dispatch. They declare MULTIs as an expensive way of performing a simple
if/else on the type of the second argument. Convert these to actual
if/else or switch/case statements within a single-dispatched VTABLE entry.
Some of the converted VTABLE entries should have a default case that
extracts a value from the second argument and acts on it (such as,
division within a Float PMC might simply ask for the 'get_number' value of
the second argument). Other converted VTABLE entries should have a default
case of multiple dispatch (if the second argument isn't one of the
specific anticipated types). Some converted VTABLE entries might use value
extraction as a first default for core PMC types (which are relatively
predictable) and multiple dispatch as the default-default to handle non-
core types.
The VTABLE entries in default.pmc should still perform multiple dispatch,
to allow MMD overrides from non-core types.
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/452>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets