5 ms·
"The whole nasty 'configuration' problem becomes incredibly more convenient in the Lisp world. No more stanza files, apache-config, .properties files, XML confi
by patrickmay 13y ago
"The whole nasty 'configuration' problem becomes incredibly more convenient in the Lisp world. No more stanza files, apache-config, .properties files, XML configuration files, Makefiles — all those lame, crappy, half-language creatures that you wish were executable, or at least loaded directly into your program without specialized processing. I know, I know — everyone raves about the power of separating your code and your data. That's because they're using languages that simply can't do a good job of representing data as code. But it's what you really want, or all the creepy half-languages wouldn't all evolve towards being Turing-complete, would they?"
This touches on the core problem with the whole Java ecosystem. The existence of so many tools demonstrates, first, that the underlying technology is insufficiently expressive and, second, that many programmers would rather create tools than applications.
Leaving the second aside, the kinds of tools required for Java development are largely unnecessary in the Lisp world because the language itself is expressive and extensible. You don't need different representations for data and code, separate parsers, and frankly bizarre build systems (coughmavencough).
As ESR, I believe, said "Lisp is worth learning for the profound enlightenment experience you will have when you finally get it." Unfortunately, it also makes you more aware that things don't have to be as bad as they are in the Java world.
Hopefully s-expressions will be the next aspect of Lisp rediscovered in "modern" programming languages.
- agumonkey 13y agoI think we can wait a long time (not infinite hopefully) before people let go of complex syntax (order of ~yacc) for smaller, simpler yet more programmatic (sexp, forth).
- patrickmay 13y agoThis discussion is tempting me to dust off my partially finished Scheme-based clone of Ant.
- yummyfajitas 13y agoI have no difficulty with configuration. I have a reference.conf which provides sensible defaults and is bundled in the jar file: cache { ttl = 1024 } I have an application.conf which belongs on the classpath and contains location specific configuration: cache { redis_server = "123.456.789.012:6379" } In my code, I do this: server = getRedisServer(config.getString("cache.redis_server")) server.put(key, value, ttl=config.getInt("cache.ttl") https://github.com/typesafehub/config https://github.com/typesafehub/config Java does have fugly enterprisey frameworks. But it's silly to claim that this is some property of Java. Incidentally, Python also does "code as data as config" also - see django's settings.py, for example.
- leephillips 13y agoIt's possible in any language, although usually not done with compiled languages, because then the user needs to recompile after every change to the configuration, and distributing as a binary becomes impossible. Usually not, but sometimes: I use the dwm window manager, which is written in C and configured by changing a header file and recompiling. The author points out several advantages to this, including scaring away inexperienced users who would bug him with questions.
- yummyfajitas 13y agoYou don't need to recompile a typesafe config. Application.conf overrides reference.conf - the latter only provides defaults. Recompiling a Config.scala file is fast anyway unless you change the type signature.
- taeric 13y agoConsider all of the code that goes into making typesafe config work. Then contrast that with the code necessary to store configuration as sexps.
- yummyfajitas 13y agoYes, typesafe config is an external library rather than using the built in interpreter. That is extra code. If you wanted to do things in equivalent lisp style, you'd just compile a Config.java/Config.scala file and add it to the classpath. That's only a few extra lines in your ansible script. Your configuration will be statically typedchecked - failure to include a required parameter or including a param of the wrong type will result in a compile failure. This is unconventional but a very reasonable way to go. At the moment I'm just using typesafe config because it's more or less the standard, but the more I think about it the more I like the idea of compiling my config.
- shasta 13y agoLet me see if I can channel some of ESR's pomposity: If S-expressions are the answer, you're asking the wrong question.
- shasta 13y agoI don't know why you got downvoted.
- peterashford 13y agoWhat??? Java is bad because it can't store data as code? (a) That's stupid (b) That applies to every other language in the world which isn't a lisp or scheme.
- RamiK 13y agoPython can do it. As I'm sure every interpreted language can. e.g. ./data.py: me = "RamiK" EOF ./code.py import data print(data.me) EOF