News for hackers. Stuff that matters.
Re:Avoid Null Checks by Replacing Finders with Tellers by masklinn on Monday June 17, 2013 @01:45PM (#5894628)
> If you did this everywhere

Rust does exactly this.

> your program would be slow as shit due to all the closure allocation in inner loops.

The closure can be stack-allocated or even inlined. It doesn't need to be more expensive than a C block.

> C# and Java people would be pissed.

Meh.

Re:Avoid Null Checks by Replacing Finders with Tellers by Locke1689 on Monday June 17, 2013 @01:49PM (#5894666)
Rust does exactly this.

No, Rust solved this problem by using non-nullable references. Closure allocation was a separate consideration.

The question of whether you can invent some arbitrary language that will enable your scenario isn't an interesting one. The problem is languages like Java and C#, which are heavily used and DO have nullable references. This "fix" is not one.

Re:Avoid Null Checks by Replacing Finders with Tellers by masklinn on Monday June 17, 2013 @01:55PM (#5894711)
> No, Rust solved this problem by using non-nullable references.

1. its option types provide a number of combinators which use closures, it wouldn't surprise me at all to see this kind of stuff in rust (might even be more efficient, no need to allocate and return an option)

2. and blocks are heavily pushed for use in Rust, all iteration is closure-based for instance

> The problem is languages like Java and C#

I've no idea where you got that from, TFA merely used java to illustrate the "language without syntactically lightweight functions". COBOL being a turd didn't stop people from investigating objects.

Re:Avoid Null Checks by Replacing Finders with Tellers by Locke1689 on Monday June 17, 2013 @02:00PM (#5894748)
I've no idea where you got that from, TFA merely used java to illustrate the "language without syntactically lightweight functions".

Really? We're investigating nullable reference semantics and C# and Java aren't the target? Hell the initial example -- the one that spurred the discussion -- is in Java.

Anyway, "syntactically lightweight" is a red herring -- syntax is surprisingly easy to add.