3 ms·
That is so sad. "There’s something deeply right about how list indexing and function application are the same operation". That is a quote from a recent submiss
by anonymfus 7y ago
That is so sad.
"There’s something deeply right about how list indexing and function application are the same operation". That is a quote from a recent submission about K (https://news.ycombinator.com/item?id=22504106 https://news.ycombinator.com/item?id=22504106), and that is a perfect example of how I usually get VB nostalgia attacks: somebody talks about a thing in other language they consider amazing implying that that thing is unique for that language despite it was implemented in VB and earlier. Sometimes that somebody can ever be Microsoft as they brag about adding more features into C#'s switch statement with increasingly ugly syntax in every new version completely ignoring that they did them better in VB.
- yyhhsj0521 7y agoI'm pretty sure that there are a few languages where array indexing is basically calling a function that returns a reference to the cell you're accessing.
- DaiPlusPlus 7y agoSince C# 1.0, any type can have an indexer property defined that can accept any parameter types and can can return anything - though it wasn't until C# 7.0 that we could return a first-class reference to a value, including array members (`public ref int this[int idx] => ref this.someArray[idx]`).
- sk5t 7y agoPerhaps not exactly what you mean, but Scala eschews [] for array access, and arr(0) returns the same as arr.apply(0).
- int_19h 7y agoParentheses for array indexing dates all the way back to the original Dartmouth BASIC, and from there to the very first FORTRAN. It's one of the oldest pieces of PL syntax still around in its original meaning.
- kragen 7y agoVB uses the same syntax for array indexing and subroutine invocation, but they aren't the same operation; you can't define a parameter that is either an array or a subroutine. So the extra expressive power that this unification provides in K is absent in VB.