2 ms·
I love K/q, but there's some trade-offs (probably for speed) that I find extremely aggravating. The biggest sin of all is the lack of lexical scoping. If k/q ha
by smabie 7y ago
I love K/q, but there's some trade-offs (probably for speed) that I find extremely aggravating. The biggest sin of all is the lack of lexical scoping. If k/q had lexical scoping and macros, it would probably be my ideal programming language.
Regardless, the philosophy behind the language is so different, and so incredible, I had the most fun I've had in a long time programming when I learned it. kdb+/q is a work of art and probably the best engineered piece of software I've ever come across.
- beagle3 7y agoAll Ks have basic module level lexical scoping, which does not deliver all the benefits of lexical scoping, but has none of the pitfalls of dynamic scoping either. K2/K3 did have (a version of nested) lexical scoping - an inner function would close over the values at the time definition was encountered ; you can still simulate this in later Ks by passing what you need to close over and immediately projecting over existing values, e.g. make_adder:{[n] {[n,x] n+x}[n;]} Which defines an inner two-parameter function, and then projects it over the outer n parameter (this is how K2 implemented it IIUC). But that doesn't let you modify names in an upper scope, so is not really comparable to Lisp's lexical scoping or Lua's upvars and Python's nonlocals or whatever they are called these days. Andrey Zholos' kuc[0] dialect has a JIT and real closures, you might find that interesting, though it hasn't seen an update in a while. > probably the best engineered piece of software I've ever come across. As you can probably tell, I'm a K fan and evangelist myself. Yet personally I cringe at some of the kludges. I love K. It's awesome, it's amazing, but I wouldn't use the "best engineered" label myself; "Best set of tradeoffs" would probably be my description (which is a distinction without difference to some, I recognize - those who define engineering as the art and craft of the tradeoff). [0] http://althenia.net/kuc http://althenia.net/kuc