Hello World problem

T

Tim Slattery

John Dildy said:
I have entered the Hello World file correctly but I am told I am missing a semicolon in line 1 when I attempt to run the file.

Here is my script:

https://script.google.com/d/1Agf_C5ERSvWtsMt4LigAxCDTpj598IkMSd4reLRpefMf83xbcyuMo9iI/edit

Anyone able to help me understand where exactly I have to put the semi colon at?

Here's what I see there:

function myFunction() {

}

That looks like JavaScript, not Java. They are very different things.
Which are you actually trying to use?

Assuming it's JavaScript, you have an empty function. It looks to me
like it should run, but it wouldn't do anything. How did you try to
run it?

If you are trying to use JavaScript, this conversation should move to
comp.lang.javascript
 
J

John Dildy

I have made changes to the project and I don't see the empty Javascript function. However, I am trying to use Java.

Does anyone know if there is a beginner's group on google about Java and/or Javascript. I see to be contacting people that are way a way's from the HelloWorld.java
 
A

Arne Vajhøj

I have made changes to the project and I don't see the empty Javascript function. However, I am trying to use Java.

Does anyone know if there is a beginner's group on google about Java and/or Javascript. I see to be contacting people that are way a way's from the HelloWorld.java

comp.lang.java.help may be a bit more beginner friendly than
comp.lang.java.programmer!

comp.lang.javascript sounds as if it is a good place for
JavaScript, but I have never read it.

Arne
 
J

Joerg Meier

I have made changes to the project and I don't see the empty Javascript function. However, I am trying to use Java.
Does anyone know if there is a beginner's group on google about Java and/or Javascript. I see to be contacting people that are way a way's from the HelloWorld.java

Java is not related to Javascript. As you have posted on

https://script.google.com/d/1Agf_C5ERSvWtsMt4LigAxCDTpj598IkMSd4reLRpefMf83xbcyuMo9iI/edit

your project files end with .js, which is Javascript, and not .java, which
is Java. Your code also contains "function myFunction()", which is a
Javascript function, and not a Java method.

I'm afraid you really are completely in the wrong place here. Despite the
strange similarity in name, Java and Javascript really are not related AT
ALL. This isn't like Basic and Visual Basic, two versions of the same
language, Java and Javascript are as unrelated as Georgia, USA and Georgia,
the country next to Russia.

People here are of course perfectly capable of "Hello World" examples, but
only in the language of this newsgroup - which is Java. We don't know
anything at all about Javascript (other than by random chance).

That being said, even people in a Javascript help group won't be able to
help you if you ignore peoples replies. Multiple people have asked you
questions about your attempted "Hello World" example, yet you have answered
none. If you are looking for mind readers, you might have to go look for a
different newsgroup alltogether.

Liebe Gruesse,
Joerg
 
J

John Dildy

For some reason the Google Script is messing with my file which I clearly classified it as .java instead of .js (javascript)

I have done the same with eclipse and I have gotten the right output in the HelloWorld.java file.

Thank you for giving some information out.
 
J

Joerg Meier

For some reason the Google Script is messing with my file which I clearly classified it as .java instead of .js (javascript)

That's because Google Script is a Javascript scripting language.

Liebe Gruesse,
Joerg
 
A

Arne Vajhøj

I visited some years ago. Not a friendly place.

Hm.

Dislike of beginners or narrow definition of on topic?
In any case, I don't think its a suitable language for a programming
newbie: maybe things have changed, but I wasn't able to find a good book
to learn it up from. I was looking for something like the O'Reilly
Python, PHP or awk&sed books, but could find nothing apart from
collections of code snippets and definitely nothing with a coherent
description of its syntax and run-time environment.

I have not read it myself but Professional JavaScript for Web Developers
from Wrox get good reviews and I have good experience with their
Professional Xxxxxxx books.

And ECMA-262 is not hard to read. It is a lot easier than JLS.

Runtime environment is a bit more tricky, because it somewhat
depends on the runtime.

:)

Old IE, new IE, FF, Chrome, node.js etc. are not identical.

Arne
 
A

Arne Vajhøj

I asked about language manuals, got pointed at "Javascript for the World
Wide Web", which I thought should be good because I like Elizabeth
Castro's "HTML for the World Wide Web" a lot. However the Js book isn't
nearly as good: instead its much as I described with the language
elements being buried under a heap of examples and details of browser
specifics. There are some pretty good books where I worked at the time,
but none seemed any better: most seemed to be aimed at people who can't
program but who can paste half-understood bits of code into their web
pages and hack at them until they do something useful.

The ECMA-262 specification was never mentioned on that newsgroup or I'd
have grabbed and used it.

It is pretty compact.

188 pages to cover both language and some core classes (a la
java.lang package in Java),
Yes, sure. But, is that poor language design and specification or merely
a lack of rigour on the part of the interpreter writers?

Well - I am not a JavaScript expert, but based on my very limited
knowledge about this then the main problem is that use of JavaScript
in browsers are highly dependent on the HTML DOM model and CSS support
used in the browser. So JavaScript is really suffering from the chaos
in the HTML world and not so much due to its own problems.

Obviously browser JavaScript and node.js usage varies a lot - applets
and Java EE are also quite different.

Arne
 
J

John Dildy

Could someone just delete or either stop replying, I have it fixed, just that I shouldn't be putting the .java codes into a .js scripture tool.
 
J

Joshua Cranmer

It is pretty compact.

188 pages to cover both language and some core classes (a la
java.lang package in Java),

That's a pretty unfair comparison. JavaScript is dynamically-typed,
which means it just has to cover runtime semantics and can ignore a lot
of the complexity that statically-typed object-oriented systems bring.
Effectively, JS only needs to specify equivalents to sections 1-3, 14,
and 15 of the JLS (with small portions of other sections), which comes
out 215 pages by my count. Even then, the JLS also includes bulky parts
in these sections that JS can happily ignore a lot of, including how to
find candidate method overloads (a thick 30 pages unneeded in dynamic
languages).

The core JS library is also pitiful by Java's standards, being far
smaller than even just java.lang: Array corresponds vaguely to
java.lang.ArrayList, String to java.lang.String, Math to java.lang.Math,
Number to java.lang.Double, Date to java.util.Date (minus almost all
locale concerns), RegExp to java.text.regex.Pattern, and Object and
Function both covering features which don't really exist in Java but
could be considered roughly equivalent to java.lang.Class.
Well - I am not a JavaScript expert, but based on my very limited
knowledge about this then the main problem is that use of JavaScript
in browsers are highly dependent on the HTML DOM model and CSS support
used in the browser. So JavaScript is really suffering from the chaos
in the HTML world and not so much due to its own problems.

When most people talk about JS, they're really talking about JS +
"HTML5", which I'm using here to refer to both the DOM APIs presented by
the HTML specification itself and the large collection of auxiliary APIs
that are assumed to be implemented by web browsers. Most variance in
practice tends to be associated with the DOM.

That said, there are some places where I've heard that increasing
compatibility is contentious by various engine writers; the biggest one
I know of is the iteration order of object properties (particularly if
you have both "foo" and 0 as properties...).
 
J

John Dildy

Like I have had my problem realized that it was Javascript. However, I thank all of you giving information about JavaScript. I really do, it is just there are some repeats which is making this discussion pretty much repeated constant.

I have understand that I am having to use an IDE like Eclipse.
 
L

Lew

John said:
Like I have had my problem realized that it was Javascript. However, I thank all of you giving information about JavaScript. I really do, it is just there are some repeats which is making this discussion pretty much repeated constant.

I have understand that I am having to use an IDE like Eclipse.

It's not a requirement, it's a convenience.

If you do Javascript work, the Aptana plugin (or standalone studio version) for
Eclipse is pretty good. I do mixed-language work (JS, Java, Python, Ruby, ...) and I
love this plugin.
http://www.aptana.com/

Alas, I don't know of any way to make Eclipse friendly for editing bash/zsh scripts.
 
J

John Dildy

It's not a requirement, it's a convenience.



If you do Javascript work, the Aptana plugin (or standalone studio version) for

Eclipse is pretty good. I do mixed-language work (JS, Java, Python, Ruby, ...) and I

love this plugin.

http://www.aptana.com/



Alas, I don't know of any way to make Eclipse friendly for editing bash/zsh scripts.

I didn't really mean to say it was a requirement
 
A

Arne Vajhøj

That's a pretty unfair comparison. JavaScript is dynamically-typed,
which means it just has to cover runtime semantics and can ignore a lot
of the complexity that statically-typed object-oriented systems bring.
Effectively, JS only needs to specify equivalents to sections 1-3, 14,
and 15 of the JLS (with small portions of other sections), which comes
out 215 pages by my count. Even then, the JLS also includes bulky parts
in these sections that JS can happily ignore a lot of, including how to
find candidate method overloads (a thick 30 pages unneeded in dynamic
languages).

The core JS library is also pitiful by Java's standards, being far
smaller than even just java.lang: Array corresponds vaguely to
java.lang.ArrayList, String to java.lang.String, Math to java.lang.Math,
Number to java.lang.Double, Date to java.util.Date (minus almost all
locale concerns), RegExp to java.text.regex.Pattern, and Object and
Function both covering features which don't really exist in Java but
could be considered roughly equivalent to java.lang.Class.

It may be unfair but what so?

It is still only 188 pages.

It does not get easier to read more pages by the fact that more
pages is necessary due to the nature of the language.
When most people talk about JS, they're really talking about JS +
"HTML5", which I'm using here to refer to both the DOM APIs presented by
the HTML specification itself and the large collection of auxiliary APIs
that are assumed to be implemented by web browsers. Most variance in
practice tends to be associated with the DOM.

That said, there are some places where I've heard that increasing
compatibility is contentious by various engine writers; the biggest one
I know of is the iteration order of object properties (particularly if
you have both "foo" and 0 as properties...).

It is my understanding that the problem of different DOM's will
mostly go away with HTML 5 as that standard actually specify the DOM.

Arne
 
G

Gene Wirchenko

[snip]
Hm.

Dislike of beginners or narrow definition of on topic?
Difficult to know. Seemed most like a bunch of acolytes fawning on every
word of a self-appointed newsgroup leader who knew almost nothing except
Javascript but didn't let that stop him handing down tablets about other
languages.

I do follow it. There are a few people like that, but most are
not. It is friendly to beginners actually trying to learn.

[snip]

Sincerely,

Gene Wirchenko
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top