3 ms·
What's stopping Swift from using the C# dynamic keyword scheme as a starting point? https://msdn.microsoft.com/en-us/library/dd264741.aspx https://msdn.microso
by batgar 10y ago
What's stopping Swift from using the C# dynamic keyword scheme as a starting point?
https://msdn.microsoft.com/en-us/library/dd264741.aspx https://msdn.microsoft.com/en-us/library/dd264741.aspx
C# does an excellent job of bridging dynamism and hard types.
The use of the dynamic keyword ensures that you know you are bridging to an area where the "." is not type checked, and is strictly evaluated at runtime.
There may be too many hooks into the reflection area of C# / .NET, however that can be mitigated in other ways within the confines of Swift.
Could even have an 'if ... let' Swift scheme that attempts to conform an object to a specific dynamic protocol. Example: Define an expected interface as a protocol, then do a 'dynamic if..let cast' which will ensure that all members from the protocol are present on the Swift object.