News for hackers. Stuff that matters.
Re:Making the move from Scala to Go by kazinator on Wednesday January 25, 2017 @08:28PM (#13487962)
Today I caught a bug in a macro-expanding code walker, where it was expanding the wrong form. The syntax being walked is (foo-special-operator x y z . rest). x and z are ordinary forms that need to be expanded; y is a destructuring pattern (irrelevant here). The walker was expanding z in the place of x: that is to say, expanding z twice, and using that as the expansion of both x and of z. That's simply due to a typo referring to the wrong variable.

The type system would be of donkey all use here, because everything has the correct type, with or without the mistake. The code referred to the wrong thing of exactly the right type.

A lot of code works with numerous variables or object elements that are all of the same type, and can be mixed up without a diagnostic.

Re:Making the move from Scala to Go by neilparikh on Thursday January 26, 2017 @11:22AM (#13492637)
So the issue you faced was that you used z twice, and x not at all? In that case, linear types (http://edsko.net/2017/01/08/linearity-in-haskell/) may have caught that.
Re:Making the move from Scala to Go by kazinator on Thursday January 26, 2017 @12:57PM (#13493551)
x not being used at all can be caught by a simple unused variable warning.

In this situation, the variable's value was used somewhere, so that didn't go off.

Re:Making the move from Scala to Go by codygman on Friday January 27, 2017 @08:44AM (#13499719)
If you used newtypes for z and x it would have been caught.