What is scala’s experimental virtual pattern matcher?

The “virtualized” pattern matcher is a rewrite of the existing matcher. The motivation for doing this was to support virtualization of pattern matching for the polymorphic embedded DSLs, not relevant for 2.10. As Iulian says in the comments below: It’s very similar to how for-comprehensions are compiled: instead of directly generating code, they are translated … Read more

What is the syntactical equivalent to switch/case in Python? [duplicate]

TL;DR As of Python 3.10.0 (alpha6 released March 30, 2021), Python has an official syntactical equivalent called match. The basic syntax is: match value: case condition: action(s) … For older Python versions, there are only workarounds if you don’t want to resort to if–elif–else. See this excellent community post for a collection of some. Example … Read more

Regular expression in PostgreSQL LIKE clause

Like @a_horse commented, you would have to use the regular expression operator ~ to use bracket expressions. But there’s more. I suggest: SELECT * FROM tbl WHERE value ~ ‘^00[^0]’ ^ … match at start of string (your original expression could match at any position). [^0] … a bracket expression (character class) matching any character … Read more