mirror of
https://github.com/dlang/dmd.git
synced 2025-04-25 20:50:41 +03:00
Add changelog
This commit is contained in:
parent
ad0c250c21
commit
bfa9192eb4
1 changed files with 38 additions and 0 deletions
38
changelog/dmd.objc-improvements.dd
Normal file
38
changelog/dmd.objc-improvements.dd
Normal file
|
@ -0,0 +1,38 @@
|
|||
Objective-C selectors are now automatically generated when not specified with @selector.
|
||||
|
||||
Additionally, the Objective-C selector generation rules have changed, following these steps:
|
||||
1. Functions marked with @property will generate `setXYZ:` for the setters.
|
||||
2. For property functions named with a "is" prefix, the `is` will be stripped off in the setter.
|
||||
3. Selector generation now uses the names of the function parameters instead of their D mangled types.
|
||||
|
||||
Selectors may still be specified with the @selector UDA, in which case it takes precedence over the
|
||||
automatically generated selectors.
|
||||
|
||||
These new rules apply both for extern and non-extern objective-c classes and protocols.
|
||||
|
||||
---
|
||||
extern(Objective-C)
|
||||
extern class NSObject {
|
||||
static NSObject alloc(); // Generates as `alloc`
|
||||
NSObject init(); // Generates as `init`
|
||||
}
|
||||
|
||||
extern(Objective-C)
|
||||
class Fox : NSObject {
|
||||
bool fluffy;
|
||||
|
||||
@property bool isFluffy() => fluffy; // `isFluffy`
|
||||
@property void isFluffy(bool value) { fluffy = value; } // `setFluffy:`
|
||||
|
||||
void yip(int a) @selector("bark:") { // `bark:`
|
||||
// ...
|
||||
}
|
||||
|
||||
void doSomething(int a, int b, int c) { // `doSomething:b:c:`
|
||||
// ...
|
||||
}
|
||||
}
|
||||
---
|
||||
|
||||
These changes should not break any existing code as the automatic selector generation
|
||||
was not present before. And automatic selector generation only applies to extern(Objective-C) methods.
|
Loading…
Add table
Add a link
Reference in a new issue