Hacker News new | past | comments | ask | show | jobs | submit login

I'm not sure if it's XCode / playground acting up, but array equality is broken for me: `[1, 2, 3] == [1, 2, 3]` returns false. This seems to contradict the core declarations though:

/// Returns true if these arrays contain the same elements.

func ==<T : Equatable>(lhs: T[], rhs: T[]) -> Bool

Works alright for dictionaries. Is there a bug tracker for Swift anywhere to report this?

Edit:

Whoops, copied wrong declaration. ContiguousArrays actually work fine, but require an extra cast. e.g.

ContiguousArray([1, 2, 3]) == ContiguousArray([1, 2, 3])




var one = [1, 2, 3]

var two = [1, 2, 3]

one == two

That's because Swift checks for safety first (variable declaration).


Can you explain what you mean by `checks for safety first (variable declaration)`?

This issue only seems to affect arrays. Strings, numbers, and dictionaries are fine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: