Skip to content

Inter-operation of =~/=~~ and named captures #55

@cdornan

Description

@cdornan

This

replaceAll "${d}/${m}/${y}" $ src *=~ [re|${y}([0-9]{4})-${m}([0-9]{2})-${d}([0-9]{2})|]

could be accidentally written as

replaceAll "${d}/${m}/${y}" $ src =~ [re|${y}([0-9]{4})-${m}([0-9]{2})-${d}([0-9]{2})|]

and it would pass the type checker, but behave differently.

The named captures were designed to work with the new operators, which can easily preserve the capture names in the definite result type — not so easy in the case of =~.

I can see three options for the 1.0.0.0 release:

  1. leave everything as it is;

  2. remove the old =~ and =~~ operators from the API;

  3. fix them up so that when they yield Match or Matches results they preserve the capture names.

The question answers it self I think — we should do 3 of course.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions