Skip to content

Speed up literal string patterns and fix a bug of unexpected capturing

Compare
Choose a tag to compare
@thautwarm thautwarm released this 03 Feb 17:54
· 257 commits to master since this release
  • Improve string pattern performance
@match str begin
   "This" => ...
end

Now we use === instead of == to make string comparisons at julia v1.1+.

  • Avoid to regard symbol nothing as as-pattern:
    A bug occurred at the previous version, where nothings are not treated as literals, so following assertion used to fail.
@assert @match 1 begin
    nothing => false
    _ => true
end # => 

Solved via defining a special pattern before capturing to handle with this.