all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#2816: regexp-opt: does not optimize 'Abc' and 'abc'
@ 2009-03-29 15:28 Jari Aalto
  2009-03-29 17:13 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Jari Aalto @ 2009-03-29 15:28 UTC (permalink / raw)
  To: Emacs bug BTS


A)

    (regexp-opt
      '("Abc"
        "abc"))

    => "\\(?:[Aa]bc\\)"

B)

    (regexp-opt
      '("Abc"
        "def"
        "abc"))

    => "\\(?:Abc\\|abc\\|def\\)"

Shouldn't regexp-opt optimize B case as well?

Jari






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#2816: regexp-opt: does not optimize 'Abc' and 'abc'
  2009-03-29 15:28 bug#2816: regexp-opt: does not optimize 'Abc' and 'abc' Jari Aalto
@ 2009-03-29 17:13 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2009-03-29 17:13 UTC (permalink / raw)
  To: Jari Aalto; +Cc: Emacs bug BTS, 2816

> A)

>     (regexp-opt
>       '("Abc"
>         "abc"))

>     => "\\(?:[Aa]bc\\)"

> B)

>     (regexp-opt
>       '("Abc"
>         "def"
>         "abc"))

>     => "\\(?:Abc\\|abc\\|def\\)"

> Shouldn't regexp-opt optimize B case as well?

The `opt' of regexp-opt should be understood in the sense of
optimization used in compilers, not in the formal mathematical sense of
"optimal".  I.e. it does some effort to improve things, but without any
guarantee about what is and what isn't optimized.

So, yes, it would be good if it did do what you suggest, but it's not
a bug if it doesn't.


        Stefan





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-29 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-29 15:28 bug#2816: regexp-opt: does not optimize 'Abc' and 'abc' Jari Aalto
2009-03-29 17:13 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.