Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32477

Re: questions re Javascript

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.javascript, comp.lang.java.programmer
Subject Re: questions re Javascript
Date 2015-09-03 01:45 +0200
Organization solani.org
Message-ID <ms81n8$tlh$1@solani.org> (permalink)
References <2b531f48-fff9-4c73-a116-22a3f110e919@googlegroups.com> <020920150828500988%timstreater@greenbee.net> <java-and-javascript-20150902121750@ram.dialup.fu-berlin.de> <ms7u1o$guu$1@solani.org> <closures-20150903000011@ram.dialup.fu-berlin.de>

Cross-posted to 2 groups.

Show all headers | View raw


Stefan Ram wrote:

> "Christoph M. Becker" <cmbecker69@arcor.de> writes:
>> Does that really work in Java?  Most certainly the following won't:
>> int x = 2;
>> String y = "x";
>> x + y;
> 
>   Not exactly in this wording, but essentially:
> 
> public final class Main
> { public static void main( final java.lang.String[] args )
>   { final int x = 2;
>     final java.lang.String y = "x";
>     java.lang.System.out.println( x + y ); }} /* prints:
> 2x                                             */

Interesting, thanks!  Nonetheless this seems to be rather a particular
convenience regarding "constants", and not a general flexibility of the
type system.

>> versions of JavaScript and Java were *very* different.  Early versions
>> of Java didn't even have closures (a basic building block of all but the
> 
>   One must not confuse the syntactic feature of function literals
>   (called »lambdas«) with the semantic feature of entities that
>   »close over« (contain) local environments (called »closures«).

Thanks for the clarification.

>   (Possibly, the first versions of LISP had lambdas, but not
>   closures, too, then closures were invented to solve the 
>   »outward funarg problem« IIRC.)

IIRC, early versions of LISP where dynamically scoped (a concept I still
can't really grasp, and what unfortunately is reflected by `this` in
ECMAScript), whereas only later versions (most notably Common Lisp and
Scheme) defaulted to lexical scoping (which is much more intuitive to me).

Anyhow, I still think that Java has its main roots in C++, and
JavaScript in Scheme, and as such I'd categorize Java as
object-oriented, but JavaScript as functional (actually, applicative)
programming language (the lines are blurred, and are becomming more
blurred as time goes by, though).

PS: I'm aware of Guy L. Steele's influence on Scheme, Common Lisp *and*
Java.

-- 
Christoph M. Becker

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: questions re Javascript "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-09-03 00:43 +0200
  Re: questions re Javascript "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-09-03 01:45 +0200
    Re: questions re Javascript Lew <lewbloch@gmail.com> - 2015-09-23 16:07 -0700
  Re: questions re Javascript Arne Vajhøj <arne@vajhoej.dk> - 2015-09-03 19:57 -0400
    Re: questions re Javascript "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-09-04 02:37 +0200

csiph-web