From: Alberto Riva on 18 Feb 2010 11:53 Haris Bogdanovic wrote: > That's what I meant at first place. > It's great because you can make your language that makes sense, not just a > bunch of commands, so when you look at the code few days later you know what > part does what, don't have to have a headache figuring that out. > So I agree, it's great for maintenance and making large programs. Exactly. They allow you to write programs focusing on WHAT they should do, not HOW they should do it (at least in theory, practice then is another matter, as usual... ;) Alberto
From: lbolla on 21 Feb 2010 06:42 On 19 Feb, 19:13, t...(a)sevak.isi.edu (Thomas A. Russ) wrote: > > So, it is possible to build up such abstractions in Java, but to my eyes > that looks a lot clunkier and less integrated than the Lisp macro > solution. You see, there isn't any way of introducing new forms into > Java that look like the language itself. So there isn't any way to add > your own control structure construct that looks like > > with_open_file (out, filename) { > // do stuff > } > In Python, decorators could be used to mimic this behaviour (very quick-and-dirty hack): def with_open_file(f): def helper(filename): out = None try: out = open(filename) f(out) except Exception, e: print e if out: try: out.close() except Exception, e: print e return helper @with_open_file def f(out): print out.read() f('test.txt')
From: Slobodan Blazeski on 23 Feb 2010 13:52
On Feb 23, 1:35 am, t...(a)sevak.isi.edu (Thomas A. Russ) wrote: > It isn't a question about whether the > language in question has something like WITH-OPEN-FILE. Rather it is > about whether a normal programmer could ADD something like that to the > language without having to change the compiler. Great summary, added to my collection of quotes and tweeted it. Bobi |