Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Scaevolus
Apr 16, 2007

quote:

If an operator has no whitespace on the left but is followed immediately by a dot (.), it is treated as a postfix unary operator. As an example, the ++ operator in a++.b is treated as a postfix unary operator (a++ . b rather than a ++ .b).
Why would you need a++.b?

I can't find documentation on how newlines are handled semantically.

Does Swift use Clang's modules system?

Neat features: Explicitly opting into nulls. Implicit break / explicit fallthrough on switch statements.

Checked arithmetic operations return an error, but how can you handle it?

Adbot
ADBOT LOVES YOU

Scaevolus
Apr 16, 2007

rjmccall posted:

Hmm. We should definitely provide operators that return an overflow bit back. I'll file that.
What happens when you cause an overflow with normal arithmetic, though? It specifies that it's trapped and reported as an error, but is there any way for a user to handle that?

The language used in the documentation is somewhat confusing -- normally arithmetic overflow behaviors are truncate/wrap, saturate, trap/except, widen, undefined.

Truncating addition is a clearer name for +& than overflow addition.

Scaevolus fucked around with this message at 04:37 on Jun 5, 2014

Scaevolus
Apr 16, 2007

Axiem posted:

This might be my lack of functional programming background speaking here, but what's the big deal with tail recursion? And why would I as a programmer even care whether or not the language is doing it--isn't it something under the hood anyway?

Some algorithms are naturally expressed as recursive functions. Writing recursive functions without a language promise that they'll be turned into tail calls (jump instead of call) is a quick way to overflow your stack.

  • Locked thread