Is It Possible to Unify KCL and Python Regex Interfaces?
Is It Possible to Unify KCL and Python Regex Interfaces?
Is your feature request related to a problem? Please describe: When working with regular expressions (regex), I've encountered a significant inconsistency between KCL and Python that has led to confusion and wasted time. This discrepancy exists in the way each language handles the regex.match function.
In KCL regex match has interface:
regex.match(key, pattern)
while in python
regex.match(pattern, key)
Sources: https://www.kcl-lang.io/docs/reference/model/regex#match https://docs.python.org/3/library/re.html#re.match
Describe the feature you'd like:
Change an order of parameters of regex.match function in KCL
Yes, the issue you mentioned does exist. It was a consideration when designing the parameter order in the KCL regex package. Initially, we thought about keeping it consistent with Python, but in order to simplify the functionality, the function and parameter names in the entire regex package were not consistent with Python. KCL hopes to make a simpler Python like language instead of being compatible with it. In addition, not all languages have parameter order of (pattern, input), such as C# is also (input, pattern). Although adjusting the parameter order can be considered, it will break the existing module ecosystem and KCL code. 😢