gluecodium icon indicating copy to clipboard operation
gluecodium copied to clipboard

Allow regex replacements in NamingRules

Open DanielKamkha opened this issue 6 years ago • 1 comments

[Original issue by @Dschoordsch]

As an API designer using current exception naming rules is quite cumbersome. The default is error.suffix=Error for Swift and error.suffix=Exception for Java. So if I can call my exception exception Some(SomeErrorCode it works fine. In real world use cases however often I have

class Some {
    enum SomeErrorCode...
    @Swift("SomeError")
    @Java("SomeException")
    exception SomeException(SomeErrorCode)

since I cannot name the exception Some without causing confusion and potentially causing ambiguity issues. To solve this, it would be nice if I could continue using SomeException name in Lime, but have a Swift naming rule like error.suffix = replace('Exception$', 'Error') which allows to do regex replace.

DanielKamkha avatar Jan 14 '20 12:01 DanielKamkha

The syntax for this needs some improvements. In the initial proposal, it's quite cumbersome to distinguish a regex suffix and a verbatim suffix.

An alternative would be to specify it like "error.suffix.replace = foo, bar", where "foo" is allowed to be either a regex or a string.

DanielKamkha avatar Jan 14 '20 12:01 DanielKamkha