[ 
https://issues.apache.org/jira/browse/HBASE-2270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838593#action_12838593
 ] 

ryan rawson commented on HBASE-2270:
------------------------------------

Actually I think the continues are good, a continue is a manageable and easier 
to understand form of 'goto', but I still think it's kind of funny that we have 
gotos at some level in a language that explicitly does not support them.

Now, if we wanted to get rid of them, we can get rid of them... The solution is 
to take the original function, restructure it slightly so it has the form:

myFunc(args) {
  if (boundary_case) 
     return some_value;
  if (other_things)
      logic_etc;
      return other_value;
  return myFunc(args); // tail recursive call does the recursive call as the 
_last_ thing
  // the non-tail recursive function might do:
  // return myFunc(args) + other_data;


This is translatable into:
myFunc(args) {

  for(;;) {
  if (boundary_case) 
     return some_value;
  if (other_things)
      logic_etc;
      return other_value;
  }
}

literally during a tail recursive call, you just replace the recursive with a 
goto/loop to the top of the logic again.

> Improve how we handle recursive calls in ExplicitColumnTracker and 
> WildcardColumnTracker
> ----------------------------------------------------------------------------------------
>
>                 Key: HBASE-2270
>                 URL: https://issues.apache.org/jira/browse/HBASE-2270
>             Project: Hadoop HBase
>          Issue Type: Improvement
>            Reporter: Jean-Daniel Cryans
>            Assignee: Jean-Daniel Cryans
>            Priority: Minor
>             Fix For: 0.20.4, 0.21.0
>
>         Attachments: HBASE-2270.patch
>
>
> Ryan was saying in HBASE-2259:
> {quote}
> the variable 'recursive' should really be named something more accurate. the 
> continue at the end of the loop should get optimized out, but it looks like 
> bad form. also commented out code should not be in the patch, just remove it.
> since this call is also tail recursive, this should be solvable with a 
> while(true) and return statements only, no boolean necessary. That would be a 
> more straightforward port, so lets do that instead.
> {quote}
> Let's fix ExplicitColumnTracker and WildcardColumnTracker at the same time.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to