title: objective-c Parameters not passes properly
body: <p>I have the following code:</p>
  
  <pre><code>[self swap:set :begin :begin+i];  //swap
  </code></pre>
  
  <p>calling the following swap method:</p>
  
  <pre><code>-(void) swap:(NSMutableString *)set:(NSInteger)first:(NSInteger)second 
  {
     NSRange rangeSecond = NSMakeRange((NSUInteger) second, 1);
     NSRange rangeFirst = NSMakeRange((NSUInteger) first, 1);
  
     NSString *chsecond =  [set substringWithRange:rangeSecond ];
  
     [set replaceCharactersInRange:rangeSecond 
                        withString:[set substringWithRange:rangeFirst]];
     [set replaceCharactersInRange:rangeFirst 
                        withString:chsecond];
  }
  </code></pre>
  
  <p>The very first time this swap routine is called, it crashes at the statement:</p>
  
  <pre><code>[set replaceCharactersInRange:rangeSecond 
                     withString:[set substringWithRange:rangeFirst]];
  </code></pre>
  
  <p>without leaving any debug information.
  Before calling swap I can hover over set, begin and i and they all have valid values.  After swap is called when I hover over "first" it says (data variable, no debug info)first    (unknown type)</p>
  
  <p>This program was working fine and this happened suddenly.  Any idea why this is happening?  Thanks</p>
  
  <p>Here is the whole chain of calls.  start StartPermutate calls permute which calls swap.
  Is there any problems in the way I pass the parameters?</p>
  
  <pre><code>-(void) permute: (NSMutableString *) set :(NSInteger ) begin  :(NSInteger ) end {
  int i;
  int range = end - begin;
  if(range == 1) {
      if([self is_word_valid:set]) {
          [self addWord:selectedWords : set];
      }
   } else {
      for(i=0; i&lt;range; i++) {
          NSLog(@"set = '%@', first = '%@', second = '%@'", set, begin, begin + i);
          [self swap:set :begin :begin+i];  //swap
          [self permute:set :begin+1 :end]; // recursion
          [self swap:set :begin :begin+i];  // swap back
      }
   }
  }    
  
  -(NSMutableArray *)StartPermutate: (NSMutableString *) letters {
  
   [self permute:letters :0 :(NSInteger)[letters length]];
   return selectedWords;
  }
  </code></pre>