Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > why is Java the way it is?

Reply
Thread Tools

why is Java the way it is?

 
 
Ian Semmel
Guest
Posts: n/a
 
      08-28-2008


Roedy Green wrote:
> On Wed, 27 Aug 2008 12:39:23 +0100, Tom Anderson
> <(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
> said :
>
>> int x = (int y = 1) + 1;
>>
>> Isn't legal. This:

>
> Why not? I am not asking about the language as defined now, but what
> the language designers might have been thinking when they concocted
> the syntax.


They might have considered it and asked "Why on earth would anyone want to write something like that?"
 
Reply With Quote
 
 
 
 
Andreas Leitgeb
Guest
Posts: n/a
 
      08-28-2008
Roedy Green <(E-Mail Removed)> wrote:
> Figuring out nesting and fixing broken nesting is
> by far the syntax feature of Java what wastes the
> most of my time and the one that I find hardest
> just to eyeball.


What editor do you use? Most editors designed
for coding should have a feature "find matching
paranthese/brace/bracket/...".
In vi, it's "%". I've seen it in ultraedit as well
(but don't remember the keyboard shortcut) and
I'd be surprised, if eclipse and netbeans didn't
have such a feature.

> I suggest some ways out in my Scid project. See
> http://mindprod.com/project/scid.html


&%$/&%$&/Webwasher seems to have decided that your page
belongs to categories: (Politics, Extreme).
(Just for your information. I've got my ways
to still view it, though less convenient)
 
Reply With Quote
 
 
 
 
Mike Schilling
Guest
Posts: n/a
 
      08-28-2008
Andreas Leitgeb wrote:
> Roedy Green <(E-Mail Removed)> wrote:
>> Figuring out nesting and fixing broken nesting is
>> by far the syntax feature of Java what wastes the
>> most of my time and the one that I find hardest
>> just to eyeball.

>
> What editor do you use? Most editors designed
> for coding should have a feature "find matching
> paranthese/brace/bracket/...".
> In vi, it's "%". I've seen it in ultraedit as well
> (but don't remember the keyboard shortcut) and
> I'd be surprised, if eclipse and netbeans didn't
> have such a feature.


IntelliJ, at least, has the ability to indent the code according to
the nesting level. This makes missing or superfluous braces obvious.


 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      08-28-2008
On Wed, 27 Aug 2008, Mike Schilling wrote:

> Tom Anderson wrote:
>> This:
>>
>> int place ;
>> while ((place = s.indexOf(x)) >= 0 ) ...
>>
>> Can be written:
>>
>> for (int place; (place = s.indexOf(x)) >= 0 ...

>
> Or
>
> for (int place = s.indexOf(x); place >= 0; place = s.indexOf(x))
>
> Which isn't bad except for the redunancy in the first and third clauses.


Even worse! More characters duplicated, and a duplication where
differences between the two won't be caught by the compiler - with the
duplicated variable name, they probably will.

tom

--
I have been trying to find a way of framing this but yes, a light meal is
probably preferable to a heavy one under the circumstances. -- ninebelow
 
Reply With Quote
 
Tom Anderson
Guest
Posts: n/a
 
      08-28-2008
On Thu, 28 Aug 2008, Roedy Green wrote:

> On Wed, 27 Aug 2008 12:39:23 +0100, Tom Anderson
> <(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
> said :
>
>> int x = (int y = 1) + 1;
>>
>> Isn't legal. This:

>
> Why not? I am not asking about the language as defined now, but what
> the language designers might have been thinking when they concocted the
> syntax.


I would guess it just never occurred to them. The model of statements and
expressions, with the former containing the latter but not vice versa, is
a very ancient one, that has generally served us pretty well.

tom

--
I have been trying to find a way of framing this but yes, a light meal is
probably preferable to a heavy one under the circumstances. -- ninebelow
 
Reply With Quote
 
Stefan Ram
Guest
Posts: n/a
 
      08-28-2008
Tom Anderson <(E-Mail Removed)> writes:
>I would guess it just never occurred to them. The model of
>statements and expressions, with the former containing the
>latter but not vice versa, is a very ancient one, that has
>generally served us pretty well.


In Java, an expression /can/ contain a statement.

In C, »( printf( "a" ), printf( "b" ))« is an expression for
a sequence of evaluations at run time. Something statements
are used for in many other languages.

In LISP languages, there really is no such distinction,
there only are nested lists in the source code (S-expressions).
But some lists are more like statements, other more like expressions.

In Assembler, there only are simple operations, which are more
like statements.

In pure functional languages, there are no statements nor
sequences of evaluations.

In natural language (English), there are noun phrases and
verb phrases, which approximately correspond to expressions
and statements, respectively.

 
Reply With Quote
 
Martin Gregorie
Guest
Posts: n/a
 
      08-28-2008
On Thu, 28 Aug 2008 08:10:48 -0700, Mike Schilling wrote:

> Andreas Leitgeb wrote:
>> Roedy Green <(E-Mail Removed)> wrote:
>>> Figuring out nesting and fixing broken nesting is by far the syntax
>>> feature of Java what wastes the most of my time and the one that I
>>> find hardest just to eyeball.

>>
>> What editor do you use? Most editors designed for coding should have
>> a feature "find matching paranthese/brace/bracket/...".
>> In vi, it's "%". I've seen it in ultraedit as well (but don't remember
>> the keyboard shortcut) and I'd be surprised, if eclipse and netbeans
>> didn't have such a feature.

>
> IntelliJ, at least, has the ability to indent the code according to the
> nesting level. This makes missing or superfluous braces obvious.


It also indicates the matching brace by momentarily highlighting it.
I like that, the syntax colouring, on-the-fly syntactic and semantic
checks and its refactoring facilities, but I find its straight forward
editing features and cursor movement capabilities disappointing. ymmv,
but IMO its clunky editing really detract from its usability, so much so
that its only marginally better than a non-language-aware editor.


--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      08-30-2008
On 28 Aug 2008 08:00:39 GMT, Andreas Leitgeb
<(E-Mail Removed)> wrote, quoted or indirectly quoted
someone who said :

>What editor do you use? Most editors designed
>for coding should have a feature "find matching
>paranthese/brace/bracket/...".
>In vi, it's "%". I've seen it in ultraedit as well
>(but don't remember the keyboard shortcut) and
>I'd be surprised, if eclipse and netbeans didn't
>have such a feature.


I have such features both in SlickEdit and Intellij Idea. However,
the other { is usually not on screen. So this feature is not all that
useful. For it to work I would need a giant screen, perhaps a metre
square where I could pretty well always fit an entire class on the
screen at once.

I think you should be able to label {} so that if they get out of
whack some pretty primitive intelligence can figure out where the
problem is and automatically fix it.

For example if {} used to bracket a method were somehow "stronger"
than ordinary {} your mismatchings would be confined to a method.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      08-30-2008
On Thu, 28 Aug 2008 08:10:48 -0700, "Mike Schilling"
<(E-Mail Removed)> wrote, quoted or indirectly quoted
someone who said :

>IntelliJ, at least, has the ability to indent the code according to
>the nesting level. This makes missing or superfluous braces obvious.


catch 22. If you run the reformat when {} are not balanced it REALLY
screws up the code. I don't use the feature until I have a clean
compile, which makes it useless for helping find {} balance errors.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      08-30-2008
On Thu, 28 Aug 2008 17:14:06 +0100, Tom Anderson
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone who
said :

>I would guess it just never occurred to them. The model of statements and
>expressions, with the former containing the latter but not vice versa, is
>a very ancient one, that has generally served us pretty well.


FORTH makes no such distinction. You can save a value at any point in
the evaluation of an expression. Assignment is just another operator,
conceptually no different from +.

On of the very first languages I used was called Act V,
a sort of primitive FORTRAN which ran on an LGP-30 computer with
tubes, a rotating drum, and no RAM. It too made no distinction.

I can't think of any assembler, other that PL-360 that treats
assignment as a special operator.

So for me, treating assignment as special seems a bit odd, the reverse
of most people.

Granted FORTRAN, COBOL, Basic , PL-1, Pascal and C were very
statement oriented.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hey i am just started java,, can anyone tell me the use ,application, why java , importance of java.. manish sahu Java 3 02-14-2008 12:00 AM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
way way way OT: MCNGP Announcement Neil MCSE 174 04-17-2006 05:55 PM
AMD Opteron: 1-way, 2-way, ... Up to 8-way. John John Windows 64bit 12 12-27-2005 08:17 AM



Advertisments