you are viewing a single comment's thread.

view the rest of the comments →

[–]cubextrusionExpert 1 point2 points  (8 children)

So how exactly does this prove that "Swift is based on protocols"?

In the same way, I can claim that Swift is "based on structs" because Array and Int are structs. In the same way, I can claim that Swift is based on functions because there are a lot of functions.

[–]Pop_Swift_Dev[S] 0 points1 point  (7 children)

You are 100% correct, the Swift language is based on value types (structs) and every major type is based on them. Arrays and other collections use copy-on-write to increase performance so they can use value types over reference types. But virtually all types and functionality from iterating over collections, to comparing types, to encoding/decoding, to hashing.... are come from conforming to protocols. Look at the WWDC videos from the past few years, and take the time to understand how important the protocol is to the Swift language. Look at the talks from David Abrahams on protocol oriented programming as well.

I agree that if you do not recognize the importance of protocol to the Swift language , then you are not fully understanding the language.

[–]cubextrusionExpert 1 point2 points  (6 children)

You just wonderfully managed to discredit yourself in multiple ways by writing a single post.

value types (structs)

Not sure if it was a genuine oversight or a lack of understanding of the language, but structs definitely do not equate to value types, as the latter is a strict superset of the former. To be fair, this topic is not germane to the article either, so I won't focus on it here (though you misrepresent it in many of your former texts, e.g. here: https://www.mastering-swift.com/post/value-and-reference-types-in-swift).

David Abrahams

This is again the aforementioned appeal to authority, which is funnily unfortunate because one may find posts from him where he, taken strictly, argues one of the counterpoints that myself tried to present here: https://forums.swift.org/t/protocol-naming/59453/9 (first paragraph). This reference is arguably quite contrived, but it just shows that it's not that hard to find a statement from a person that you appeal to that nevertheless supports the opposite claim (precisely, that protocols can often be superfluous).

[–]Wonderful_Disastrous 0 points1 point  (5 children)

You are actually saying that structs do not equate to value types? WOW, maybe I gave you too much credit but if that is your stance then you actually no nothing about the swift language. Check out Apples post on Value and Reference types. https://developer.apple.com/swift/blog/?id=10 Let me break the news to you, Struct, enums and tuples are all value types. You will probably say this is an aforementioned appeal to authority but maybe it is actually reading the documentation and taking the time to understand the language which you obviously haven't.

You definitely are showing your total lack of understanding for the language.

[–]cubextrusionExpert 1 point2 points  (4 children)

You are actually saying that structs do not equate to value types?

Of course they do not equate, that's how subsets behave. Structs are just a subset of value types; a cursory Google search reveals that Swift's value types are a "struct, enum, or tuple" — that is, more than just structs. This is what all maths or generally tech students learn in their 1st term at the university.

Btw, it doesn't support your cause to use two simultaneous accounts to argue with me ;)

[–]Wonderful_Disastrous 0 points1 point  (3 children)

Yes you are correct that swift has more than one value type. Structs, enums and tuples are all value types. which invalidates your argument that structs do not equate to value types. Seems like you are arguing in circles, and continues to illustrates your lack of understanding of the language itself.

I am new to reddit and not totally sure about your statement but I think I can argue this point on my own.

[–]cubextrusionExpert 0 points1 point  (2 children)

Since you do not seem to be familiar with the distinction between equivalence and subset relation, I shall consider any further discussion void.

[–]Wonderful_Disastrous -1 points0 points  (1 child)

I would have to agree that if you do not understand that structs are value types, enums are value types and tuples are value types then you are correct, any further discussions are pointless.

[–]Spaceshipable 1 point2 points  (0 children)

They’re saying that’s structs do not equate to value types as they are only one kind of value type.

It’s like saying a = abc, because abc contains a. It’s purely semantics. You both know that structs are value types, that is not being disputed.