diff options
Diffstat (limited to 'wiki/java')
| -rw-r--r-- | wiki/java/a-new-kind-of.md | 20 | ||||
| -rw-r--r-- | wiki/java/install/centos.md | 2 | ||||
| -rw-r--r-- | wiki/java/install/ubuntu.md | 2 | ||||
| -rw-r--r-- | wiki/java/kwargs.md | 6 |
4 files changed, 15 insertions, 15 deletions
diff --git a/wiki/java/a-new-kind-of.md b/wiki/java/a-new-kind-of.md index 48cee4b..6cc81e5 100644 --- a/wiki/java/a-new-kind-of.md +++ b/wiki/java/a-new-kind-of.md @@ -5,20 +5,20 @@ previews](http://jdk8.java.net/download.html) right now, and I think you should, even if you don't like Java very much. There's so much _potential_ in there. -## The "One More Thing" +## The “One More Thing” The Java 8 release comes with a slew of notable library improvements: the new [`java.time`](http://openjdk.java.net/jeps/150) package, designed by the folks behind the extremely capable Joda time library; [reflective access](http://openjdk.java.net/jeps/118) to parameter names; [Unicode 6.2](http://openjdk.java.net/jeps/133) support; numerous others. But all of -these things are dwarfed by the "one last thing": +these things are dwarfed by the “one last thing”: **Lambdas**. ## Ok, So..? -Here's the thing: all of the "modern" languages that see regular use - C#, +Here's the thing: all of the “modern” languages that see regular use - C#, Python, Ruby, the various Lisps including Clojure, and Javascript - have language features allowing easy creation and use of one-method values. In Python, that's any object with a `__call__` method (including function @@ -27,12 +27,12 @@ features allow _computation itself_ to be treated as a value and passed around, which in turn provides a very powerful and succinct mechanism for composing features. -Java's had the "use" side down for a long time; interfaces like `Runnable` are -a great example of ways to expose "function-like" or "procedure-like" types to +Java's had the “use” side down for a long time; interfaces like `Runnable` are +a great example of ways to expose “function-like” or “procedure-like” types to the language without violating Java's bureaucratic attitude towards types and objects. However, the syntax for creating these one-method values has always been so verbose and awkward as to discourage their use. Consider, for example, -a simple "task" for a thread pool: +a simple “task” for a thread pool: pool.execute(new Runnable() { @Override @@ -46,7 +46,7 @@ a simple "task" for a thread pool: Even leaving out the optional-but-recommended `@Override` annotation, that's still five lines of code that only exist to describe to the compiler how to package up a block as an object. Yuck. For more sophisticated tasks, this sort -of verbosity has lead to multi-role "event handler" interfaces, to amortize +of verbosity has lead to multi-role “event handler” interfaces, to amortize the syntactic cost across more blocks of code. With Java 8's lambda support, the same (dumb) example collapses to @@ -62,7 +62,7 @@ software. ## Event-Driven Systems -As an example, I knocked together a simple "event driven IO" system in an +As an example, I knocked together a simple “event driven IO” system in an evening, loosely inspired by node.js. Here's the echo server I wrote as an example application, in its entirety: @@ -83,7 +83,7 @@ example application, in its entirety: } } -It's got a bad case of Javascript "arrow" disease, but it demonstrates the +It's got a bad case of Javascript “arrow” disease, but it demonstrates the expressive power of lambdas for callbacks. This is built on NIO, and runs in a single thread; as with any decent multiplexed-IO application, it starts to have capacity problems due to memory exhaustion well before it starts to @@ -120,7 +120,7 @@ Terser **and** clearer than the corresponding try-with-resources version: ## Domain-Specific Languages I haven't worked this one out, yet, but I think it's possible to use lambdas -to implement conversational interfaces, similar in structure to "fluent" +to implement conversational interfaces, similar in structure to “fluent” interfaces like [UriBuilder](http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/UriBuilder.html). If I can work out the mechanics, I'll put together an example for this, but diff --git a/wiki/java/install/centos.md b/wiki/java/install/centos.md index 7cbfacf..51c83f6 100644 --- a/wiki/java/install/centos.md +++ b/wiki/java/install/centos.md @@ -29,7 +29,7 @@ Applications that can't autodetect the JDK may need `JAVA_HOME` set to The [Java SE Development Kit 7](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html) -tarballs can be installed by hand. Download the "Linux x64" `.tar.gz` version, +tarballs can be installed by hand. Download the “Linux x64” `.tar.gz` version, then unpack it in `/opt`: cd /opt diff --git a/wiki/java/install/ubuntu.md b/wiki/java/install/ubuntu.md index c74ff04..75d3478 100644 --- a/wiki/java/install/ubuntu.md +++ b/wiki/java/install/ubuntu.md @@ -56,7 +56,7 @@ enough not to be able to detect the JDK, you can set `JAVA_HOME` to The [Java SE Development Kit 7](http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html) -tarballs can be installed by hand. Download the "Linux x64" `.tar.gz` version, +tarballs can be installed by hand. Download the “Linux x64” `.tar.gz` version, then unpack it in `/opt`: cd /opt diff --git a/wiki/java/kwargs.md b/wiki/java/kwargs.md index bd78d85..d745010 100644 --- a/wiki/java/kwargs.md +++ b/wiki/java/kwargs.md @@ -123,7 +123,7 @@ Possibilities for syntax: * `foo(x := 5, y := 8, z := 2)` - `:=` is never a legal sequence of tokens in Java. Introduces one new operator-like construct; the new sequence `:=` - "looks like" assignment, which is a useful mnemonic. + “looks like” assignment, which is a useful mnemonic. * `foo(x ~ 5, y ~ 8, z ~ 2)` - `~` is not a binary operator and this is never legal right now. This avoids introducing new operators, but adds a novel @@ -133,7 +133,7 @@ Possibilities for syntax: * `foo(.x = 5, .y = 8, .z = 2)` - using `=` as the keyword binding feels more natural. Parameter names must be legal identifiers, which means the leading dot is unambiguous. This syntax is not legal anywhere right now (the dot - always has a leading expression). The dot is a "namespace" symbol already. + always has a leading expression). The dot is a “namespace” symbol already. To support this, the class file format will need to record the names of parameters, not just their order. This is a breaking change, and generated @@ -149,4 +149,4 @@ from debug information, where present.) * Inheritance. It is legal for a superclass to define `foo(a, b)` and for subclasses to override it as `foo(x, y)`. Which argument names do you use when? -* Varargs.
\ No newline at end of file +* Varargs. |
