3 ms·
Are they really any more similar to each other than to any other random language? E.g. Java: try(Writer f = new PrintWriter("foo.txt")) { f.println("
by lmm 9y ago
Are they really any more similar to each other than to any other random language? E.g. Java:
try(Writer f = new PrintWriter("foo.txt")) {
f.println("hello, world");
}
try(BufferedReader f = new BufferedReader(new FileReader("foo.txt"))) {
println(f.readLine());
}
- sametmax 9y agoThe difference here is that you don't need to know the name of the types of all the things, nor write them. Or wrap an object in another object.
- lmm 9y ago> The difference here is that you don't need to know the name of the types of all the things, nor write them. I believe the latest version of Java would allow "var", fwiw. > Or wrap an object in another object. True. The java standard library's I/O functionality is quite low-level, perhaps excessively so. In practice there are libraries that give a more lightweight/high-level interface.
- sametmax 9y ago> I believe the latest version of Java would allow "var", fwiw. While Python gained type hinting. It's funny how in the end stuff converge.
- xyrouter 9y agoDo other popular languages support a similar construct? C? C++? Perl? The Java try-with-resources was introduced in Java 7 (2011). The Python with statement was introduced in Python 2.5 (2006). The Lisp with-open-file has been in Common Lisp Hyperspec for a long time (1960s?). Not that it takes anything away from Java. I think all languages are gradually converging to the features of Lisp.
- lmm 9y ago> Do other popular languages support a similar construct? C? C++? Perl? C? No, though I don't really think of that as an actively maintained language. C++ and Perl achieve the same thing via RAII. > Not that it takes anything away from Java. I think all languages are gradually trying to or discovering the approach the features and expressiveness of Lisp. I think language design converges over time, alternating between expressive-but-unmaintainable and structured-but-too-strict but getting closer to the ideal as we advance. In many ways Lisp isn't a complete language design at all - rather macros are there for the user to finish the language themselves.
- sedachv 9y ago> C? No, though I don't really think of that as an actively maintained language. Why would you think that? Work on the C standard is ongoing: http://www.open-std.org/jtc1/sc22/wg14/ http://www.open-std.org/jtc1/sc22/wg14/
- lmm 9y agoJust that I hadn't heard of a new release since 1999, shrug.
- kazinator 9y ago> I don't really think of that as an actively maintained language. Oh, were it only so! It's an actively diddled language.
- brianberns 9y agoC# has the "using" statement, which is effectively the same construct. F# calls it "use".
- wk_end 9y agoLisp as an idea or language family was around in the 60s, Common Lisp not so much. Common Lisp The Language was published in 1984, CLtL2 in 1990, and the ANSI standard in 1994. I believe the hyperspec (which is not the spec) was published in 1996 or so. CL is neither as ahead of its time or of another, past time as you might think.