[OT] Apple introduces Swift as Objective-C sucessor

Chris Cain via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 3 02:42:34 PDT 2014


On Tuesday, 3 June 2014 at 08:33:14 UTC, ponce wrote:
> On Tuesday, 3 June 2014 at 00:57:53 UTC, Chris Cain wrote:
>> On Monday, 2 June 2014 at 23:01:56 UTC, deadalnix wrote:
>>> On Monday, 2 June 2014 at 22:53:10 UTC, ponce wrote:
>>>> - no exceptions (!)
>>>
>>> How do they do error handling ?
>>
>> I haven't read too much into Swift but languages with ADTs, 
>> pattern matching, and no exceptions can (and usually do) 
>> return using an ADT
>
> Ocaml and Haskell also have ADT and exhaustive matching.
> Yet Ocaml provides exceptions. Haskell provide the Exception 
> monad to avoid littering the code with error-checking.
> Of course ADT are great and all but if error checking is 
> verbose it won't encourage people to check for errors.

Of course not all languages with ADT and pattern matching have no 
exceptions. But the ones that don't have exceptions get by using 
the process I described. And verbosity is usually taken care of 
(somewhat) well with macros if the language supports them.

But yes, like I stated, it usually feels similar to a system with 
checked exceptions, which has the natural problem of "not 
encouraging people to check for errors." So I'm not going to 
suggest it's the perfect way, but it is quite impressive how the 
features added together can accomplish so much.


More information about the Digitalmars-d mailing list