Comment by lowmagnet
12 years ago
I guess to me the data thing was neat because you didn't have to bust into another shell just to get at data.
12 years ago
I guess to me the data thing was neat because you didn't have to bust into another shell just to get at data.
Here's how to get a string from your persistent on disk configuration, completely from scratch:
set foo=^config("foo")
The '^' means it's a persistent variable.
Now do this with in the same number of characters either by reading in a flat file or doing an SQL query in any language. I don't think you'll succeed.
And, yes, it is possible to parameterise this ^config, like so:
set location="^config"
set foo=@location@("foo")
I don't get it. That seems like a rather trivial library thing to add in most languages, at least ones that let you define operators. Otherwise you'd just fine top-level functions "configp" or whatnot.
Just like "one letter abbreviations". Again, just "let w = printf" if that's what you're into. I do that kind of stuff all the time, with limited scope.
The fact that easy persistent on-disk storage other than through file streams or sqlite and the like is still not a built-in feature or a commonly used library in languages in 2013 when MUMPS did this in 1960-something then that's more a commentary on the state of things not MUMPS than the other way round.
Sure, you can do import json; json.load(open('config.json')); json['foo'] and I have code like that in production right now, but put pickle in comparison to the above and I'd know which one seems nicer, and not least of all changing ^config("foo") is fully concurrent, caching, network transversable, auditable, with Caché supporting these things like an operating system should, but in a built-in way.
I could write a library in Scala that allows almost this exact syntax. Say...
val fooConfig = "config" ^ "foo"
Of course, there would be some config required. There are various ways to handle that, but it could be as minimal as a single line of code. I don't want to be critical of your work, but my own preference is for languages which are DSL-friendly. Although there are some disadvantages (possible lack of fluidity, mildly more verbose), I feel the advantages (lack of vendor lock in, composable with the rest of the language) are worth the trade-off.
Admittedly I've never had experience with MUMPS, but I have used PHP. Until pretty recently, that was a language which attempted to break down the barriers between its syntax and the runtime environment at the expense of the language. Reams have been written on the PHP argument, and I won't contribute further here; just noting that my preference for languages with a flexible syntax and a "do it in a library" attitude is based on having experience with the opposite.
Have you had experience with any of the embeddable-DSL languages (Ruby, Clojure, Scala, Haskell)?
With the new string interpolation syntax you could define config"key": Option{Result] and even config"base/userdata/$user/$key": Option[Result].