3 ms·
My guess is there is something "stringly typed" somewhere in the system. A sibling comment mentions Swift, but I doubt all components of iCloud are written in
by userbinator 6y ago
My guess is there is something "stringly typed" somewhere in the system.
A sibling comment mentions Swift, but I doubt all components of iCloud are written in it.
- valleyer 6y agoSwift has "stringly-typed" enumerations (enumerations with backing "raw values" of string type), but it does not treat the enumerations as equal to the strings. Explicit conversion is required. https://docs.swift.org/swift-book/LanguageGuide/Enumerations.html https://docs.swift.org/swift-book/LanguageGuide/Enumerations... 1> let _: Bool = "true" error: repl.swift:1:15: error: cannot convert value of type 'String' to specified type 'Bool' let _: Bool = "true" ^~~~~~
- jjnoakes 6y agoI don't think I'd consider it stringly-typed then. To me, stringly-typed means the type system treats strings and non-strings as convertible to each other implicitly. Strings backing enums seems more like an implementation detail and not a type system feature.
- valleyer 6y agoI see what you're saying, but it's not 100% an implementation detail. The raw values are accessible through the `rawValue` property, which can be useful for serialization, for example. (That could of course be abused to create bugs like the one here.) The reason I say Swift "has" stringly-typed enums is that Objective-C has them (typedefs of NSString where the values are actually strings, and are of course implicitly convertible), and Swift imports them as enums with string-typed raw values. Anyway, I mostly just meant to suggest that this particular iCloud bug is probably not Swift-related.
- dangwu 6y agoI'm pretty sure Apple uses Java for their backend services
- comex 6y agoGoogling the beginning of the error message, "Type error: cannot set value", suggests it's coming from JavaScript code.
- ulucs 6y agoJs doesn't really care about types, and doesn't seem to convert a string "true" into a boolean true: > temp0.innerHTML = true // no error > "true" == true false > true == "true" false
- Izkata 6y agoThe javascript matches are "TypeError" not "Type error", and the more important part of those are "...of null" or "...of undefined". They refer to this: var foo = null; foo.lastName = "anything"; // TypeError, cannot set property "lastName" of null