Re: Optionals? A better option!
Re: Optionals? A better option!
- Subject: Re: Optionals? A better option!
- From: Jens Alfke <email@hidden>
- Date: Fri, 15 May 2015 09:31:19 -0700
> On May 15, 2015, at 4:34 AM, has <email@hidden> wrote:
>
> Lisp has a `nil` object. That's not the same thing as a nil pointer. The first is an actual Thing; the second is a promise to give you a thing that instead drops you down a hole when you actually ask for it.
Yes, but when you evaluate (cdr nil) doesn’t the interpreter trigger an exception? (Sorry, it’s been decades since I used LISP.) Similarly, in Smalltalk-80 ‘null’ is a real object, a singleton of class UndefinedObject, but trying to message it is going to raise a message-not-handled exception. The difference from a nil pointer is mostly that you get a language-level rather than an OS-level exception.
> I *really* wish Swift designers had copied FP's elegant type declaration and pattern matching syntax, instead of godawful C++ hideousness. It's so much cleaner it isn't funny.
I said similar things when Java first came out — “it’s a whole new language! Why did they have to copy the awful C syntax?” — but from a pragmatic standpoint I was wrong. A big part of the reason Java took off was that it looked familiar to C and C++ programmers. A language with an awesome syntax is still a failure if people won’t adopt it. (Of course you can take that too far end end up with miserable pidgins like PHP…) For better or worse, all* of the languages I know of in the new Modern Systems Programming category (Go, Rust, Swift, …) have a surface-level similarity to C.
—Jens
* Oops, Nim doesn't. But Nim also doesn’t seem to have as much traction, which bolsters my point.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden