Swift thingies

A discussion today about what the bits you create in Swift are called. Here’s a very rough and untested first go at things:

According to the Swift Programming Language, structures, enumerations, classes are constructs. (As are closures.) You use these to construct instances, according to this blog post at the Apple Swift blog, which means you probably can also instantiate as well as construct them, although that sounds a little iffy.

Instances of structures are structs. Instances of classes are either objects or instances. Instances of enumerations appear to be enums, although I did not find authoritative cites on this. Closure instances are closures, of course, just like functions are functions — unless they are methods by being defined within a class.

While you can assign values to variables of any type, only enumeration and structure instances (and tuples) are value types. Class instances are reference types.

Hopefully the next iteration of Swift, likely to debut in a few weeks, will offer some more concrete names for things. Until then, I’d be interested in hearing what you have to say about these terms.

Corrections? Expansion? Better verbage and nounage? Let me know. Thanks!

Comments are closed.