rmuir opened a new issue, #14202:
URL: https://github.com/apache/lucene/issues/14202

   ### Description
   
   These automata operations have two forms today, using concatenate() as an 
example:
   
   ```java
     /**
      * Returns an automaton that accepts the concatenation of the languages of 
the given automata.
      *
      * <p>Complexity: linear in total number of states.
      */
     public static Automaton concatenate(Automaton a1, Automaton a2) {
       return concatenate(Arrays.asList(a1, a2));
     }
   
     /**
      * Returns an automaton that accepts the concatenation of the languages of 
the given automata.
      *
      * <p>Complexity: linear in total number of states.
      */
     public static Automaton concatenate(List<Automaton> l) {
       ...
   ```
   
   I think these helpers are trappy, in that it makes it too easy to use 
Automaton like a StringBuilder:
   ```java
   while (someloop) {
     automaton = Operations.concatenate(automaton, other);
   }
   ```
   But if you do it this way, it does not run in linear time.
   
   So I'd propose to just deprecate the `concatenate(a1, a2)` in favor of 
`concatenate(List.of(a1, a2))` and the same thing with the `union()` if you 
really just want to concatenate/union two things, it isn't causing you too much 
additional pain. If you want to concatenate/union 3 or more things, it 
encourages that you do it in the performant way.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to