Swift programming language inconsistency

  • Be sure to checkout “Tips & Tricks”
    Dear Guest Visitor → Once you register and log-in please checkout the “Tips & Tricks” page for some very handy tips!

    /Steve.
  • BootAble – FreeDOS boot testing freeware

    To obtain direct, low-level access to a system's mass storage drives, SpinRite runs under a GRC-customized version of FreeDOS which has been modified to add compatibility with all file systems. In order to run SpinRite it must first be possible to boot FreeDOS.

    GRC's “BootAble” freeware allows anyone to easily create BIOS-bootable media in order to workout and confirm the details of getting a machine to boot FreeDOS through a BIOS. Once the means of doing that has been determined, the media created by SpinRite can be booted and run in the same way.

    The participants here, who have taken the time to share their knowledge and experience, their successes and some frustrations with booting their computers into FreeDOS, have created a valuable knowledgebase which will benefit everyone who follows.

    You may click on the image to the right to obtain your own copy of BootAble. Then use the knowledge and experience documented here to boot your computer(s) into FreeDOS. And please do not hesitate to ask questions – nowhere else can better answers be found.

    (You may permanently close this reminder with the 'X' in the upper right.)

Any Swift programming language developers here? I notice that there is some grammatical inconsistency with the language.

Example 1​

Take for example optional binding:

if let constantName = someOptional { ... }

Within the 'if' statement, you don't need to force unwrap 'contantName' to access the value in 'someOptional'. In other words, the right side of the assignment is an optional, while the left side is a non-optional.

But in other context, both sides of the assignment have to be optionals:

anotherOptional = someOptional

You need to force unwrap 'anotherOptional' to access the value in 'someOptional'.

Example 2​

To assign a value to an optional, you do this:
optionalInteger = 42

To access the value of the same option, you do this:
optionalInteger! // 42

In the first statement, the left side of the assignment is an optional while the right side is a literal. They are not the same data types. To be grammatically consistent, it should be:

optionalInteger!=42

My rant​

These types of grammatical inconsistencies increases the cognitive load on programmers!! 🙄

I yearn for the good old days of the C programming language, where the grammar of the language is highly consistent.