Author: elfprince13
Posted: 17 Oct 2012 12:06:57 am (GMT -5)
I think it does, and this seems reasonable. Instead of an if, have a 2 entry array of function references, and call it with
Code:
A switch statement could be used to do the same thing inline, which sheds some overhead if the Javascript interpreter is smart enough to turn that into a jump table instead of a conditional.
_________________
StickFigure Graphic Productions || VSHI: Vermont Sustainable Heating Initiative
![]()
Posted: 17 Oct 2012 12:06:57 am (GMT -5)
AHelper wrote: |
Does js have function pointers? That can solve it. |
I think it does, and this seems reasonable. Instead of an if, have a 2 entry array of function references, and call it with
Code:
read_behavior[!(boolean && test || condition || here)](reference,to,necessary,state,here);
A switch statement could be used to do the same thing inline, which sheds some overhead if the Javascript interpreter is smart enough to turn that into a jump table instead of a conditional.
_________________
StickFigure Graphic Productions || VSHI: Vermont Sustainable Heating Initiative


