Swift: Use same keyword for class methods as for static struct methods

Originator:stephan.michels
Number:rdar://17228621 Date Originated:09-Jun-2014 09:29 AM
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Feature (New) Reproducible:Always
 
I would prefer to use the same keyword “static” for class methods as for static struct methods instead of “class”. Otherwise the syntax of both structures are almost the same. I can’t understand why using a different keyword.


class TestClass {
	var x = 1, y = 2, z = 3
	
	class func print(value : TestClass) -> String {
		return "\(value.x), \(value.y), \(value.z)"
	}
}

struct TestStruct {
	var x = 1, y = 2, z = 3
	
	static func print(value : TestStruct) -> String {
		return "\(value.x), \(value.y), \(value.z)"
	}
}

var value1 = TestClass()
TestClass.print(value1)

var value2 = TestStruct()
TestStruct.print(value2)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!