View Full Version : Js
basic3572002
12-23-2002, 04:33 AM
i want to can goto label are usable to JavaScript. i try it in microsoft interdev it wont work.
what application program will you recommend to me for debuging JavaScript.
thanks
Skyzyx
12-23-2002, 06:43 AM
I think I've read all of your posts, and I think you are misunderstanding the point. JavaScript is NOT a full-fledged programming language. It is a scripting language. You sound like your talking about C++ or Java or something, and this is not the case.
goto commands are not available in JavaScript. Even in C++ and Java, for-loops are typically better.
I would suggest that you spend $50 USD and get a book called "JavaScript Bible" by Danny Goodman. It covers everything in JavaScript through version 1.5 for both Internet Explorer 5.5 and Netscape 6 (Mozilla 0.94). I really believe that buying a book about JavaScript will help you more than anything else will.
Hope this helps!
mordred
12-23-2002, 08:43 AM
Originally posted by Skyzyx
JavaScript is NOT a full-fledged programming language. It is a scripting language.
Hmh. I disagree with these two sentences. From my point of view, a scripting language IS a programming language. The distinction you imply is purely academic.
goto commands are not available in JavaScript. Even in C++ and Java, for-loops are typically better.
The "goto" keyword isn't used in Java, though it's a reserved keyword, same as in JavaScript. But you're right, "goto is considered harmful" is the way to go.
I would suggest that you spend $50 USD and get a book called "JavaScript Bible" by Danny Goodman. It covers everything in JavaScript through version 1.5 for both Internet Explorer 5.5 and Netscape 6 (Mozilla 0.94).
Have a look at this:
http://www.wiley.com/extras/javascript_bible_4e/
(click on Entire Book)
Skyzyx
12-23-2002, 09:00 AM
Originally posted by mordred
Hmh. I disagree with these two sentences. From my point of view, a scripting language IS a programming language. The distinction you imply is purely academic.
Yes, I suppose that they could both be called programming languages, however, "Scripting" languages are far less powerful/capable than real "Programming" languages. There's a reason why there is a differentiation between Visual Basic and Visual Basic Script -- the same concept goes for JavaScript and C++, for example. :cool:
Originally posted by mordred
The "goto" keyword isn't used in Java, though it's a reserved keyword, same as in JavaScript. But you're right, "goto is considered harmful" is the way to go.
I know it's supported in C++, and since Java is a subset of C++ (sayeth Sun Microsystems), I thought it might be part of the Java language as well. I stand corrected. ;)
Originally posted by mordred
Have a look at this:
http://www.wiley.com/extras/javascript_bible_4e/
(click on Entire Book)
Awesome! :thumbsup:
mordred
12-23-2002, 12:48 PM
Originally posted by Skyzyx
Yes, I suppose that they could both be called programming languages, however, "Scripting" languages are far less powerful/capable than real "Programming" languages.
There's a reason why there is a differentiation between Visual Basic and Visual Basic Script -- the same concept goes for JavaScript and C++, for example.
Agreed.
But are "scripting" languages really that less powerful than "real programming" languages? Consider this example: Write the code for a rollover image of a web page in C++. Not that I've got the slightest idea how to actually do this in C++, because I'm not proficient in that language, but I would suppose you'd have to write a plugin or an ActiveX-Object to achieve the desired result. Looks like a lot of work to me.
But in JavaScript, it's less than 5 lines and quickly developed. Judging from this somewhat awkward example, which language is the more powerful one?
What I want to say is that "power" should not be seen without the context in which you employ the language. If you're about to write a lightning-fast 3d shooter, then C++ would probably your language of choice. If you're planning to do an online CMS with MySQL as database, then Perl or PHP might be the language of choice. It's like a toolset; it depends on your goal which tool you chose.
Granted, languages like C++ and Java are much more general-purpose than JavaScript, but since also Java needs some kind of interpreter to run (JRE), the line between a "real" and a "scripting" language becomes very blurred when you compare Java against Python.
So much for now - nice exchange of ideas. :thumbsup:
krycek
12-23-2002, 01:32 PM
heheh... no way am I gonna get caught up in THAT arguement! :D (i.e. programming vs scripting) however I will say that Mordred is correct: JavaScript IS a programming language (starts whistling "It Wasn't Me" lol ;))
What I do want to say though, in response to basic3572002's first post, is that no matter whether JavaScript supports goto or labels etc. you should not be using them.
GOTO is a very old command that comes directly from the assembly mnemonics which are necessary because they look at a fixed area of memory.
Later on, GOTO evolved into labels in some languages (e.g. Pascal) which basically replaced the absolute addressing of the line numbers with line labels instead.
Nowadays it is not a good idea to try and use 'absolute' addressers, because we have functions instead. Seeing as modern programs do not even have line numbers, I cannot see why someone could use GOTO, let alone why they would need to.
My suggestion would simply be to learn JavaScript properly, because you will otherwise probably miss key concepts etc.
::] krycek [::
Originally posted by krycek
heheh... no way am I gonna get caught up in THAT arguement! :D (i.e. programming vs scripting) however I will say that Mordred is correct: JavaScript IS a programming language (starts whistling "It Wasn't Me" lol ;))
Javascript is interpretted. Therefore, it is not a programming language. Nobody calls Perl or Python a programming language, why do overzealous Javascripters think they can call their language programming?
I would argue that Javascript is indeed a very usable scrcipting language, and not a crippled language for webpages that people like to think, but by no means is it a programming language. One use of Javascript is for embedding into webpages, but you can use it in any environment, provided enough objects are exposed.
krycek
12-23-2002, 06:12 PM
hey! Don't pick on me! Ohhhh no... you did anyway! Aw shucks - now I have to get involved! Well, I did warn you! :p
jkd - for once, you are wrong :) (IMHO)
JavaScript is indeed a programming language. It fits all basic requirements of a programming language, and indeed, those of a high-level programming language, which it is.
That fact that it needs an interpreter does not mean it is not a programming language. Sure, there are different KINDS of programming language, but that does not mean that you can take the properties of one kind and apply it to the whole.
For instance, my calculator has not got a programming language. I can tell it to perform simple equations, but I cannot program it. But, I know someone with a glitzy graphical calculator, and he can program that. It may not DO much, but it can still be programmed.
Similarly, no-one ever denied that C64 BASIC was a programming language, yet that relied on an interpreter. I cut my teeth on the C64, and eventually moved on from BASIC to using assembler to extend the built-in BASIC functions. Assembler is a programming language, but a low-level one. It does not require an interpreter because it works closely with the binary machine code.
High-level languages such as C and it's derivatives, or BASIC and it's spin-offs etc. ALL need to be either interpreted or compiled. That is one of the distinctions between high- and low-level programming languages.
Take Java. Heck of a lot more capable than JavaScript, yet it still needs an interpreter in most cases (yes you can compile it too). It Java not a programming language? Try telling that to Sun, who made it. Heck, try telling that to O'Reily, or QUE, or Wrox... I have Java books by all of them and they think it is a programming language. Heck, I've taught Java. I'm a certified Java architect. However I did my certification very quickly so that I could get more money teaching Java, and I haven't had a lot of hands-on experience because I don't actually like it (plus I am very rusty now coz I haven't used it for a couple of years). But the important thing is the theory, which is based on C. And C theory is not all that different from any BASIC-based language. They all have fundamental concepts which mean that they are programming languages.
Now, it may well be that there has been a mix-up of definition here. Someone at some point may have said "JavaScript is not a programming language" when they meant to say something different. True, JavaScript is a "scripting" language... and JavaScript is not a "pure" language like C. But, when I was in college the definition of a programming language was the same as it is today, and I have since taught the same courses.
JavaScript IS a programming language, plain and simple :)
heheh not that everyone is gonna agree though... :p
::] krycek [::
krycek
12-23-2002, 06:35 PM
Oh yeah, just to point out that I am not the only one to think that JavaScript (and Perl, etc.) fit the definition of a "programming language", here's some links for you.
Oh but before I do:
Originally posted by jkd:
Nobody calls Perl or Python a programming language
Sorry jkd, but they do think exactly that, as the first of my links will show:
Dictionary definition of Perl:
http://hostingworks.com/support/dict.phtml?foldoc=PERL
compare that to...
Dictionary definition of Pascal:
http://hostingworks.com/support/dict.phtml?foldoc=Pascal
Hmmm, both are obviously programming languages! Shock, horror! :eek: lol :p
I also want to quote from this link:
http://www.computeruser.com/resources/dictionary/popup_definition.php?lookup=5360
Designing and writing a computer program. The programmer must decide what the program needs to do, develop the logic of how to do it, and write instructions for the computer in a programming language that the computer can translate into its own language and execute.
Now according to that, all code must be translated, no matter what "language" the code is written in. And, does it mean that a person choosing JavaScript for their task is not a programmer? No! They fit all definitions of a programmer! So how come JavaScript is not a programming language???
Well, it is the opinion of myself and many others (many in more prestigious and influential positions) that JavaScript must be a programming language, indeed, just like Perl, and Python (mentioned by jkd)... and C, and Pascal, etc.
Let me ask a question. What medium defines a particular language...? I mean, JavaScript's medium is the web. A VisualBasic program might run on Windows only. Both need their own environments to run in, and both are programming languages.
Another question. What about the word "script"? Well, that does not invalidate the arguement. I never said JavaScript was a "pure" language.
Anyone wanting to repeat the simple search I did on Google can go here:
http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=programming+language+dictionary+definition&btnG=Google+Search
There is plenty of material there to read :)
::] krycek [::
mordred
12-23-2002, 06:40 PM
Originally posted by jkd
Javascript is interpretted. Therefore, it is not a programming language. Nobody calls Perl or Python a programming language, why do overzealous Javascripters think they can call their language programming?
jkd, those responsible for the python.org site do call python a programming language:
Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java.
(taken from http://www.python.org/doc/Summary.html, emphasis added by me).
Seeing it through your eyes would mean that this definition is a contradicition in itself, and krycek did already argue that Java falls in the same category... do you really want us believe that Java is not a programming language just because it is interpreted? Isn't JavaScript internally also compiled to bytecode and interpreted?
Listen, I don't care if you claim that (speaking in set notation) scripting languages are a subset of programming languages.
I am saying that Javascript belongs to the domain of scripting. In turn, it may belong to the universe of programming, but for all intents and purposes, people draw a very significant difference between scripting and programming.
If you want to say all languages are interpretted at some point, fine. Programming languages are interpretted at a much lower level than any scripting language. There is no compilation in Javascript or Perl. Even in Java, it is compiled to bytecode before before being interpretted.
But that does not magically lift Javascript from its scripting category.
Javascript is a scripting language, and you haven't said anything to the contrary yet, which makes this argument moot.
krycek
12-23-2002, 07:04 PM
well, the original statement that JavaScript is not a "fully-fledged" programming language, in the sense of not being as powerful, as opposed to not being as developed, is debateable. What is true is that JS does not posess the necessary abilities to qualify as a "pure" langauge. Yes, it is a scripting language... but that does not mean it is not a programming language.
You say that Java is complied to byte-code, which is correct, yet C is also "complied to byte-code". What is the difference?
Also, PHP is definitely a scripting language... yet, it can be compiled! Hmmm, so where does that take your definition of a programming language...? The lines are getting blurry!
My opinion is that it does not matter as to the medium of the language, or even the abilities of the language. To be a programming language, the language has to satisfy other critieria... such as, having variables, or functions, or at least some kind of programming constructs. IF, loops, etc.
Take HTML. HTML cannot be compiled, except as a resource. Just like, you can compile a picture as a program resource but the picture on it's own can do nothing. HTML on it's own can do nothing. DHTML can... why? Because of JavaScript. :)
Now, I am talking to jkd on MSN as I write this. He points out that .chm files are compiled, as part of an arguement against my statement that HTML files cannot be compiled except as a resource. Well, yes .chm files are compiled, but they contain JS! If they don't, they can do nothing. And in any case, they are used by another program... so even the compiled code is a resource, just like a DLL.
A DLL is simply a reusable piece of code that is compiled outside of the main program. It cannot run on it's own, yet it is still code. Sometimes DLLs do not contain code, but they still contain code resources.
Anyway, that's not my arguement really! My arguement is that JS is a programming language, and I believe I have proved that :)
::] krycek [::
I claim this:
http://www.jasonkarldavis.com/venn.png
You claim that the set of scripting languages belongs entirely in programming languages.
I say that all computer languages have certain characteristics (control structures, logic, etc).
I then categorize programming languages as being compiled at some point.
Scripting languages are not.
The reason for the intersection is that like you love to say, some scripting languages can be compiled. Remembering back to Python, after running it once, bytecode is generated, which can be used to execute the same program faster. That is a form of compilation, but it is still first interpretted.
krycek
12-23-2002, 07:22 PM
Originally posted by jkd
I say that all computer languages have certain characteristics (control structures, logic, etc).
That is how I would describe a programming language.
Originally posted by jkd
I then categorize programming languages as being compiled at some point.
Scripting languages are not.
Wrong, plain and simple. (IMHO)
Scripting languages can be compiled, and also I think perhaps you are trying to define a "pure" language.
Originally posted by jkd
The reason for the intersection is that like you love to say, some scripting languages can be compiled. Remembering back to Python, after running it once, bytecode is generated, which can be used to execute the same program faster. That is a form of compilation, but it is still first interpretted.
Yes, correct. However C and VB are still interpreted. Does that mean they are not programming languages...?
Ask yourself one question:
When you write JavaScript, are you programming? Are you telling the computer what to to IF a certain thing happens? That's programming. Are you asking it to repeat something? That's programming. What about using variables, or functions? That's programming.
And, in order to program, you need to use a programming language.
I rest my case :)
::] krycek [::
Skyzyx
12-23-2002, 07:48 PM
Some of you seem to be missing the point that I had intended to bring up.
There is a difference between programming, and "Programming" languages (please note the quotes and capital letter)...
You can program JavaScript, you can program VB Script, you can program HTML, you can program a calculator, you can program Java, you can program C++, you can program Python, etc. You can program many things... including "Scripting" languages and "Programming" languages.
The primary difference is that (as JKD pointed out), "Scripting" languages are not intended to be compiled (although sometimes they CAN be compiled, as part of a greater whole, into some proprietary MS toy), whereas "Programming" languages are. You can debate that C++ could be interpretted because it is read and interpreted by a complier program..., but that's not it's intention.
Brendan Eich, the creator of JavaScript himself, distinguishes JavaScript as a "Scripting" language instead of a "Programming" language due to it's intentions of being a non-compiled language, among other things.
Yes, there are some languages that blur the edges... JavaScript isn't one of them.
Java is somewhat in a class of it's own. Instead of being complied for Win32/Pentium or MacOS/Power PC, it's compiled for a JVM. You can't just open a class file and read it... you can with JavaScript.
You need to be able to distinguish programming from "Programming" to understand the difference here.
krycek
12-23-2002, 10:04 PM
I think you will find that Brendan has never said that. At least, not to my knowledge. If he has, could we have a quote...?
What I DO know, though, is that Brendan has actually referring to JavaScript as "a programming language", and also as "a scripting language", plus he has likened it to Java and C++ in the way of it being a programming language.
I also think that your concept of "Programming" languages (capital P) is misconstrued. Like I previously said, perhaps you are thinking of "pure" languages? Please show me a published definition of capital-P Programming languages from a respectable source on the web. :)
It may well be that someone somewhere has used capital-P Programming to define a difference between traditional pure languages and scripting languages such as JavaScript. As far as I know, such a definition is not universally accepted, however your definition of capital-P Programming languages is indeed different to that of scripting languages, as I have said all along.
If you check back, one of the first things that I said was that the definitions may be being used wrongly. jkd should have made a clear distinction between capital-P Programming and lowercase-p programming languages if such a distinction exists. It is my opinion that you are muddling together other definitions such as "pure".
There are many different kinds of lowercase-p programming languages, and although scripting languages is a legitimate subset, I would not consider capital-P Programming languages to be so, simply because the definition is (according to what you have currently described) too vague.
Your understanding of compilers and interpreters also seems lacking. A compiler takes code and compiles it, once, into a lower form. For instance, C code into machine code (for use in DOS for example). This is a one-way, once-off process, because once the code is compiled, the compiled version is run.
An interpreter takes code and translates it into a form that its host can understand. Now, this could be anything. Take a look at WINE or WinLin on Linux: Windows on a Linux box. How? Because the Linux box is emulating an x86 processor etc. so that Windows thinks it is in a normal enviroment talking directly to the hardware.
If you become any stricter with the definitions, then you have to pay attention to context. Like, Java gets interpreted if not compiled: interpreted from the Java source code into instructions that the JVM can understand. Then, this code is in turn interpreted into code that the underlying layer can understand (e.g. Windows). In turn, the layer under that (possibly Linux!) ...finally, the hardware.
Modern systems can have multiple layers of things going on, and so defining what a language is by whether it is compiled or interpreted etc. would appear pointless. However your definition appears to fit that of "pure" languages in this respect: a pure language is one which is intended at some stage (either through a compiler or interpreter) to 'directly' address the hardware of the system. I put directly in quotes because that is a bit hazy. I mean, it could actually be pretty indirect!
But, look at C. C can access the hardware. Indeed, many device drivers are written in C. Look at VB. Even VB can access the hardware. Look at Java. Java cannot! But, Java has a Virtual Machine so, as you rightly said, it is out on it's own. JavaScript and similar languages cannot ever access the hardware directly. The best they can do is use something like a COM interface which still invalidates them from this definition because it is indirect.
So, although that is my condensed definition, you will see that you may have been talking about pure languages. AFAIK there is no capital-P Programming/lowercase-p programming definition distinction.
I expect that some arguement may arise over the use of the word "pure" because it implies many other things thatn I have gone into, however I am making the distinction in comparison to scripting languages in order to show that your definition was, IMHO, incorrect.
Ah well at least this interesting debate stops me from working at Christmas :)
::] krycek [::
mordred
12-24-2002, 12:36 AM
Originally posted by jkd
If you want to say all languages are interpretted at some point, fine. Programming languages are interpretted at a much lower level than any scripting language. There is no compilation in Javascript or Perl. Even in Java, it is compiled to bytecode before before being interpretted.
No internal compilation of JavaScript? Ok, I back up my claim:
http://groups.google.com/groups?dq=&hl=de&lr=&ie=UTF-8&oe=UTF-8&threadm=3E0187D8.9060201%40meer.net&prev=/groups%3Fhl%3Dde%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26group%3Dnetscape.public.mozilla.jseng
Just make a search for "compilation" in netscap.public.mozilla.jseng and you will find lots of hints that internally JS is compiled to bytecode. So it's more or less the same like in Java, only that the compiled code is not stored in a file, but in memory.
Somewhat this distinction between "programming" and "scripting" languages is IMO purely artificial. It would be more productive if we had common characteristics of what *exactly* qualifies a "language" to be a "programming" language. It seems like everyone (including me) makes up his own definition. Perhaps we have to agree on a common basis, otherwise it's all very much about semantics. I find that most often, the term "programming" language is used in regard to C, C++ and Java. Those languages that do compile and have a steeper learning curve than JS, PHP, Perl etc., you get the idea. But I still stand opposed to the idea that compilation is the most significant definition of a programming language. I chose the definition on this page http://www.webopedia.com/TERM/P/programming_language.html which leaves open whether the "programming" language must be compiled or interpreted.
krycek
12-24-2002, 02:11 AM
Very good, Mordred! I heartily agree! :)
And to help you out, I might as well share some info.
During my time spent working as a lecturer/trainer in and around the UK, I have been asked to teach at various UK universities. Now, what better thing to do, I thought earlier, than to share with you some of the information in a textbook devoted to this subject? :D
So, I went searching for my copy of Comparative Programming Languages by L.B. Wilson and R.G. Clark, which I have in its third edition.
I quote:
This book considers the principal programming language concepts and how they are dealt with in object-oriented languages such as Java and Delphi, in traditional procedural languages such as Pascal, C and Fortran, in hybrid object-oriented or object-based languages such as C++ and Ada 95, in functional languages such as ML and in logic languages like Prolog.
Hmmm... that's interesting... there seems to be no distinction between Java and the others. But hey, we knew that Java is a special case.
I now quote some of the key features of the third edition:
* Java joins Pascal and C++ as one of the central languages used in the book.
* The object-oriented approach plays a central role.
* Scripting languages such as Perl.
* The discussion of concurrency is centred on Ada 95 tasks and Java threads.
* Internet programming, including applets, CGI programs and CORBA.
Ooo my! Lookie here! "Internet programming" and also Java mentioned in the same breath and context as Pascal and C++, definitely two of the most distinguished traditional languages!
Now, by skimming the table of contents and picking out the references to different types of programming language, I found these babies:
Business data processing languages
General or multipurpose languages
Special-purpose languages
Systems programming languages
Functional and logic languages
Procedural and object-oriented languages
Declarative languages
Internet programming languages
As you can see, quite a few different types - including internet languages.
I double-checked before saying this, but:
* Nowhere in the book does it mention "Programming" (capital-P) languages.
* Nowhere does it make any distinction between between laguages based on compilation or interpretation.
* Yes it mentions JavaScript and it does not say anything about JS not being a "proper" language in the context of this debate.
Now, I point out that this is an advanced reference book, used at top UK universities (I don't know about the US or other countries) and it's now on its third edition.
Who's right? You decide :)
Oh and Mordred... hopefully that will help with the definitions (I for one am tired of people making up their own definitions and I'm sure you are too!)
::] krycek [::
Skyzyx
12-24-2002, 02:29 AM
krycek,
I will submit to your explanation of uppercase-P meaning "Pure" rather than "Programming" language... although the points you and I made seemed pretty much the same, more an issue of semantics than anything. The concepts that you presented about the differences between "Pure" and "Scripting" were still there though.
As far as Brendan Eich goes... I don't have a particular quote, although what I've read from him, here and there, implies a difference, although by calling it "a programming language", I'm sure that implies that it is a Scripting language that you program with.
mordred,
Quoted from krycek
A compiler takes code and compiles it, once, into a lower form. For instance, C code into machine code (for use in DOS for example). This is a one-way, once-off process, because once the code is compiled, the compiled version is run.
krycek is right about this part. Even in the article you linked to, it, in essence, says that the JavaScript is not traditionally compiled, but rather has to be recompiled each time, hence negating it as a "Programming" (as I called it) or "Pure" (as krycek called it) language.
krycek
12-24-2002, 02:55 AM
well that wasn't exactly...
heheh, nvm. it's near enough :p
so, it seems we have reached some form of agreement... do you know, I really enjoy these discussions. I love the way that something like this can be debated - perhaps even hotly debated! - without anyone flaming etc. and with humour still being present :D
I have never found any other forums where this is the case :)
::] krycek [::
Skyzyx
12-24-2002, 03:02 AM
:p
BrainJar
12-24-2002, 05:10 PM
It doesn't matter if a language is compiled, interpreted or ready to run (i.e., machine code). Any language that instructs a computer to perform a task can be considered a programming language. As far as I know, there is no distinction between "programming" and "Programming" language.
There's no reason you couldn't create a JavaScript compiler. Given JavaScript's flexible nature, compiled versions would likely be very inefficient compared to others, but it could be done nevertheless. Both compiles and interpreted versions of BASIC are common and have been around for decades.
There are literally thousands of programming languages. But they all have one thing in common, they define a grammer and syntax that is translated by some means to instructions that can be executed by a processor. There can be any number of steps involved in that translation but ultimately, you're flipping bits in a CPU.
krycek
12-24-2002, 05:15 PM
BrainJar :thumbsup:
Very well put mate :D
Merry Christmas Everyone!
::] krycek [::
caldasgsm
12-25-2002, 08:38 PM
What I noticed in this thread is a little lack off reading...
now, I don't remenber the sites or books where I read this so I canīt put quotes but the idead is this....
1st of all theres a diference between a language specification and inplementation...
-> a language is a way to comunicate(make statements, intructions, ....)
there's natural languages, morse code,... and theres languages that allow us to program a computer..(write intructions for him to execute)..
those have a prefix of "programing", calling them programing languages... those serve only that purpose..
but all of the obove refered languages in this thread ARE "programing languages" the upper|lower case "P" is just a way for
programers of C++,BASIC.... distinguish himselfs from other, because of their ego...
->A programing language is defined by it's specification, and designed to suit the purpose for witch it will be used...
SQL as it's own purpose but still it's a language, a programing one.. explained by the point above...
(for the one that are doubting, thrust.. me IT IS) some of them, as the ones called scripting, are more simple because or their purpose,
VBscript has made as a subset of VB and for that it can be called a subset of a programing language if you like,
but for JS... now comes the surprise... IS NOT A SUBSET... this I read in MSDN... just dont remenber where.
JS is a language, drawed from root, it as things for JAVA and as things from C/C++ making it unique.. for that, being considered a programing language not a subset..
-> now the tricky part implementation (this is where the confusion is)...
we have diferent languages, but all, I say again ALL are capable of drawing algorithms for the computer to execute...
But since those languages are not "Machine Language" whe need a program that translates the source code to machine code,
that's implementation. and there are several ways to acomplish that...
- Compilation : the source code is compiled all at once into machine code, and runned only in the end.
(the EXE file is NOT mandatory you could compile it to memory and run from there).
EX: C++, VB
- Interpretation : the source code is compiled and executed instruction by instruction, to memory and runned from there, because
this technic makes it hard to write a executable file.(the single instruction complilation makes it more slow, because it as to
evaluate semantics and syntax of an instuction before it runs. But still is not THAT slow.... I start to realise that many of those
slow scripts are the programer's fault.. being leaded by the script's easy development, design terrible algorithms and forget
about optimization)
EX: VBscript and in some aspects SQL
- 2 step Compilation/Interpretation : it uses the first technic to produce a file with the instructions writen in an intermediate
code (ByteCode) and then the file, is Interpretaded (instruction by instruction) into the machine's language by a Virtual machiche
this one depending on the CPU's architecture..(Note: an emulator is a type of virtual machine that interprets not the bytecode but
a machine code of another CPU type)
EX: java
-NOte: not that I puted languages as examples, because that's the way they are usualy implemented, but these technics can
be used with ANY programing language. unless the language specification implies restrictions...
->But you are probably thinkg what about, scripting, where those it fit...Well I make the distinction where. scripting is
every implementation that implicitly calls the compiler/interpreter. in C++ you have to explicitly call the complier.
while in JS for example you can just doubleclick the source code (.JS file) and it will run automalicly
(the interpreter is called implicitly)..
By looking at it this way. you can seen that it makes no sence discussing or distinguish programing languages. because
you can make a C++ interpreter, as easy as you can make a JS complier. And if you want to make C++ a scripting language
just implement it youself, by associating the C++ file extention to a bacth file that calls the compiler and runs the executable
file after that.. Then just double click the source code file and Voilá. you have C++ scripting:)
(just a terrible example, but i think you can get the picture)
Afert this, I hope that you have a clearer view of the subject.
And the Point Is...
There no point in discussing the implementation method or the 'purity' or the capital letter of a programing language
because the computers change to fast and today's concepts, may not exis tomorrow.. and you can never know what they are up to...
PS: about that power of JS...
shure it as to have certain components avaible, so it can acomplish some works, and some of them with restriction.
but if I has you I would spend some time with Wscript And Cscript (windows script engines)
and see the true power of a script language..
krycek
12-25-2002, 09:42 PM
I applaud you! :) That was very well put, and very well argued too. :)
I agree with what you say, and I would just like to support a couple of your points:
- Compilation vs interpretation: You are totally correct here, a compiler could be built for JS and indeed C code does not have to be compiled... there are examples where C is used on the web in uncompiled form, and also examples where JS is used in a "sort-of" compiled form :)
Plus, the power of JS is arguably nearly as good as C, because C has to deal with a lot of things that JS doesn't, and also is geared towards different tasks. Both are optimised for their specific uses, if not then you would be able to use either one without much distinction. Also, JS is an object-oriented language and as such cannot be dismissed as a "lesser" language in any way, even though it does not boast as many features. (But then, C has been around a lot longer.) And JS is only slower than C because it is translated in real-time through a browser. If a good JS compiler was written, there would be no discerable speed difference because JS is based around C syntax.
I think the distinction I made earlier between "pure" languages and what I will call "non-pure" languages is important, but still does not validate the statements made by "the opposition" ;)
I also like what you said about ego, because I got a very strong sense of it from jkd's first post (no offence meant jkd) but jkd very strongly implied, if not said outright, that JS programmers are not as good as C programmers. (Quote: "why do overzealous Javascripters think they can call their language programming")
Now I personally have considerable programming experience going back many years, and as I have previously mentioned I have teaching experience too. I know C very well and would not dream of saying that a good JS programmer is in any way inferior to a good C programmer, or that they would be "over-zealous" in comparing JS to C.
caldasgsm, overall I am very impressed with your post and your understanding of the issues involved in this debate :)
::] Merry Christmas Everyone! [::
::] krycek [::
How can you call Javascript programming on the same level as C++? That is all I was suggesting, and contrary to what you said, ego played no roll. If anything, my ego over these holidays has disappeared (never really had happy holidays), but not so much as to continue letting you ride my original post, which may or may not have been so off base.
krycek
12-25-2002, 11:06 PM
Originally posted by jkd
How can you call Javascript programming on the same level as C++? That is all I was suggesting, and contrary to what you said, ego played no roll. If anything, my ego over these holidays has disappeared (never really had happy holidays), but not so much as to continue letting you ride my original post, which may or may not have been so off base.
I am sorry to hear that your holidays are not filled with joy, but that's life I'm afraid! I for one am glad when the days of juggling various awkward (and sometimes drunk) family members comes to an end. The joy of Christmas only really exists for children, and can only be redeemed to oneself through having children.
Flipping heck that was a bit philosophical wasn't it! Ah well :) back to the topic in hand :)
A good JS programmer is not any worse than a good C++ programmer. JavaScript and C++ share concepts and even syntax. They are aimed at different applications (as in uses) and are very suitable to them. There is no reason to say that JS is any less a programming language than C++.
Indeed I think that if this whole thread has proved anything, it is that :)
::] Merry Christmas Everyone! [::
::] krycek [::
caldasgsm
12-25-2002, 11:53 PM
I refered the ego thing because I have a close example of it, near me.
the C++ team in my company, call's the programers in the web development team, 'power users'.. it's kind of a joke, betwen the two teams but still...
It's true that C++ is a more complex language and has much more too learn that JS (the languages more often refered in this thread)...
And for that I understand that C++ delevopers like to be distinguished for it.(then insisting in 'P/p'programing languages and other stuff)...
And for the effort that C++ implies, I do recognize the value....
But a language is just a away to give instructions to the CPU..
If one can use a language to do it, he can always learn a new one to acomplish that task...
For me, what realy makes a Programer is the ability to write good algorithms, and good applicational logics...
That is what defines a Programer or a programer..
The language is always and just a tool to acomplish it. and being capable of choosing the most apropriate one for the job, also defines a (P/p)rogramer...
NOTE: JS even if is was compliled would'nt have the same performance as C++ for example, the language specification says that, there are no variable types, that meaning the var type has to be avaluated in runtime(that kind code is generated automaticly by the compiler/interpreter)..that and other 'abstraction specitications' make the inplemented algorithm more slow in C++ you have to tell the CPU exactly what you want, theres a very 'low level' of abstraction.. that making the code more efficent, fast,...
But on the other and C++ would never be a Good scripting language, since to much code is necessary to acomplish even a simple task, that making complitation/interpretation on the fly a very slow process, not fited for a web page or a WSH script.
2 points -----------------------
- Every language as its purpose. and that's why there are so may.. so theres no better or worse languages they are just diferent..and only in their own group they can be compared
( JS is better that VBS :D )
- a good programer is not someone that programs on a 'Hard' language...
is someone that indenpendetly of the language, understands avery aspect of it and uses it to the full... writing good algorithm/applications
(some one that writes a (cool && good && fast) script IS a better programer that one that writes a (lousy || buggy) Program :D )
krycek
12-26-2002, 12:11 AM
Excellent! I only wish you had joined the discussion earlier :)
Oh yeah and you are right about the C++ speed thing however I was trying not to get that detailed. For all intents and purposes, general code that could be written in either would effectively run just as quick (to the user's perception) if given comparitive compilers. Sure, for intensive sorting etc. C++ would be faster, but it was more an illustration than a literal statement.
I find that because I have a broad knowledge of programming flavours and also a good knowledge of language-independant programming/logic concepts and theory, I can easily learn new languages, as any equivalent programmer should be able to do. So I totally agree that it is the skills of the coder and not the language used that is important :)
::] Merry Christmas Everyone! [::
::] krycek [::
whammy
12-26-2002, 03:23 AM
( JS is better that VBS :D )
If you're comparing JS to VBS regarding client-side scripting, you're right, of course...
However when being used with ASP (server-side), VBScript gives you a lot of built-in functions (and easier implementation with WScript/FileSystemObject, for example) that javascript doesn't have, since it was created mainly for client-side browser interpretation (of course you could write them). So regarding use with classic ASP, I would say in that case that VBS is better than JS, in general (also much more reference material is available for VB "Scripting Edition"). ;)
Still, VBScript allows some pretty darn sloppy code, which can be very annoying... I much prefer javascript (and in .NET, C#) syntax to VBScript/VB, since the C-based syntax is much more strict!
And I'm no OOP guru (yet ;)), but getting back to the topic at hand, for right now I would have to agree with the general concensus that any language that can make a computer DO something or anything depending upon certain conditions (even if rather simple) is indeed a programming language, even scripting languages. At least, that's what the definition means to me...
I can't "quote" my O'Reilly book on javascript (since I left it at work!) - but I remember distinctly that is said "javascript is a full-fledged programming language" as well.
P.S. Remind me of what I just said in a couple of years if I ever get a big head after learning C# and VB.NET... :D
krycek
12-26-2002, 03:31 AM
yup I would agree with you, whammy :)
hmmm... it seems that for once jkd is wrong... I wonder how he will respond to that?
Merry Christmas Everyone!
::] krycek [::
whammy
12-26-2002, 03:37 AM
I would think rather well, I've seen him be wrong before (if that's the case here?), although VERY rarely! ;).
All I know is he's helped me a lot along the way, with not only javascript but general programming concepts (I definitely won't ever forget his help with regular expressions, for example, not to mention other things)... and it IS appreciated!
... and by the way... a little late, but MERRY CHRISTMAS and/or HAPPY HOLIDAYS, everyone! :)
krycek
12-26-2002, 03:57 AM
yeah, it certainly is rare :)
and he gives me a lot of help too, regarding XUL, XBL Behaviours etc. :eek:
once heck of a guy :thumbsup:
Merry Christmas Everyone!
::] krycek [::
caldasgsm
12-26-2002, 12:18 PM
First of all, to me, theres no diference betwen server side, client side or WSH Languages. It all involves script engines that fortunatly, suport the two languages..JS & VBS
And since theres no limitation on context it's just a matter of taste or choosing the better language...
Now for some copy paste from msdn...
VBScript Language features:
- Error handling - Is 'on error' considered errol handling you have no control on the error handling, besides it can make your code 'buggy' and eventualy crash a server. JS as TRY CATCH, what can be better than that
- Date Formatting - Ok, One point on this one, dates ARE easy with VB
- Easier COM Interop - Even taking in consideration that COM uses a lot of collections, Still FOR EACH can hardly be considered such great advantage.. And JS as the Enumerator Obj that many forget about
- Standard Event-binding SyntaxOk. Two points, the
OBJECT_EVENT() does help in many cases, but thats only because the JS OBJECT::EVENT() specification isn't inplemented. and 'event late binding' doesn't always work..
JScript Language features:
- Dynamic - the ability for the program to rewrite it self thats probably something that no other language can do..
- Object oriented - in this days I would risk to say that a language that's not Obj oriented is not a programing language(just kidding:))
- Regular expressions - That's another plus
- Eval - evaluating expressions in runtime goes much as the fist point so I donīt consider and plus on this one
So here we have 3 against 2 for JS.. but wait... I add more...
- Key Sensitive - IS a feature that avoids bugs in code and makes the compilation/interpretation faster..
- Garbage Collected implementation - and for ones that have a web server, should know that recourses on a server ARE very important, and working with a language where you have to explicitly destroy the objects is not that 'trustable'.. In the and where is My view of things
Script Features
Error handling -> JS
Date Formatting -> VB
Easier COM Interop -> VBS & JS (dont forget the enum..OBJ)
Standard Event-binding Syntax -> VBS
Dynamic -> JS
Object oriented -> JS
Regular expressions -> JS
Key Sensitive -> JS
Garbage Collected implementation -> JS
Does any one like to add someting to the list.. or debate a point??
Skyzyx
12-26-2002, 08:23 PM
Nope. Nuh-uuuhhhhh. You're all wrong! Thpbpbpbpbpbt! :p
allida77
12-26-2002, 08:59 PM
I read most of the posts and I would have to go with the js is just scripting. There are some c++ guys on our team and they always joke with me saying that I need to learn a real programming language (c++). I do not have the techinical knowledge some of you have, but to me a true programming language is something that can be a stand alone application. Entire games and desktop applications can not be built with js. I have not seen anyone post documentation on this so I am not sure if there is a right our wrong answer just differences in opinion. In the web world I am not sure if there are any programming languages just markup and scripting languages and platforms. I know someone said something about the ego but that could go both ways. Web programmers can get touchy if you tell them they do not know a programming language and c++ guys well..they are c++ guys. I may not know any programming languages (unless vb counts :D ) but I am a programmer....if that makes sense.
Lee Brenner
12-26-2002, 11:00 PM
[sigh] I guess I'll add another voice to the discussion since my buddy allida77 pointed this interesting thread out to me.
A language is quite simply a means of communication. A language has a set of atomic elements that can be combined to convey meaning according to the language's grammar and syntax. Whether a programming language is interpreted or compiled, whether it is high-level or low-level, whether it is typed or not typed, whether its functionality is geared towards web programming or desktop application development...I think they can all be considered programming languages because they are all doing the same thing: communicating to the processor a sequence of instructions designed to elicit certain behavior from the machine.
I think it was caldasgsm who brought up the more salient point in all of this: what makes a good programmer. A good programmer is like an artist or writer...he/she is using a toolset to create something. The toolset is only important in the sense that it allows the artist/programmer to accomplish the task at hand. What is more important is what comes from within the artist/programmer...does that person have ideas and can he/she express them/bring them into reality in meaningful ways?
In the real world it all boils down to one thing: Does it work?
krycek
12-26-2002, 11:03 PM
omg will this thread never die...! :D
well first off while I remember, there is a different between JavaScript and JScript, caldasgsm, but I am sure you knew that :) Also, I agree that overall JS is better than VBS but I also agree with the points whammy made about VBS. Sometimes, it can be better (or more convenient?) to use VBS.
now to allida77.
Ok first, read what I said earlier about "pure" languages with regard to application building etc.
second, realise this: an "application" is a bit intangible in some ways. MS Word running on Windows XP is an application, but also you can build your own with C. True. But Windows is a platform, just like a web browser, and indeed you could make an entire application using Mozilla, XBL, XUL and XML, and of course JavaScript :) so I don't really see your point about applications, because it is related to platforms, and platforms can be anything. I mean, look at Windows running as an application on Linux using WINE or WinLin.
Oh yeah and I have posted some documentation to back up what I have said, so maybe you missed that :)
I still stick to my guns on this and see no valid argument against what people on this side of the debate are saying.
Merry Christmas Everyone!
::] krycek [::
krycek
12-26-2002, 11:05 PM
I have just posted and noticed that Lee Brenner has posted just before me.
Good post Lee, I heartily agree :thumbsup:
Merry Christmas Everyone!
::] krycek [::
whammy
12-26-2002, 11:49 PM
Actually, that's usually the approach you have to take with programming (at least when doing it for a company)... "Does it work" or in Bruce Li's words "Use what works".
I know I've done some applications less elegantly than they could have been done, but hey - when you've got a deadline, if it works and isn't already elegant (which I DO try to acheive), I'm apt to stick a comment in the code like:
// make this elegant later!
;)
P.S. caldasgm, good points - and I think I mostly use VBS because of (as krycek noted) convenience (since there's already a plethora of code I or others have written that I can reuse, not to mention it's a bit harder to find any good references to JScript syntax used with ASP - again the word "deadline" comes to mind!)... however VBS (at least in ASP 3) also supports regular expressions, granted they are slightly bloated regarding syntax. ;)
ca_redwards
02-12-2003, 09:57 AM
This thread is way too long, so I'll be brief:
Originally posted by caldasgsm
First of all, to me, theres no diference betwen server side, client side or
<<<snip!>>>
JScript Language features:
- Dynamic - the ability for the program to rewrite it self thats probably something that no other language can do..
- Eval - evaluating expressions in runtime goes much as the fist point so I donīt consider and plus on this one
<<<snip!>>>
- Key Sensitive - IS a feature that avoids bugs in code and makes the compilation/interpretation faster..
- Garbage Collected implementation - and for ones that have a web server, should know that recourses on a server ARE very important, and working with a language where you have to explicitly destroy the objects is not that 'trustable'.. In the and where is My view of things
Script Features
Error handling -> JS
Date Formatting -> VB
Easier COM Interop -> VBS & JS (dont forget the enum..OBJ)
Standard Event-binding Syntax -> VBS
Dynamic -> JS
Object oriented -> JS
Regular expressions -> JS
Key Sensitive -> JS
Garbage Collected implementation -> JS
Does any one like to add someting to the list.. or debate a point??
Personally, I tend to use server-side Java with supporting client-side JavaScript. However, on various free web hosts, server-side scripting is generally not available. For those environments, I invented a client-side HTML generation library (http://www.angelfire.com/ca/redwards/html__.calendar.html). This extensible 1.7K library is the ultimate in dynamic programming--- its five factory functions facilitate the creation of dozens upon dozens of specific tag/attribute/container generators. This smacks of object inheritance, yet requires no compilation (ah, the benefits of using an interpreted language!).
Yet, when given a choice, I prefer to put an application's functionality where it originates: Input validation is done client-side to minimize over-the-Net traffic and especially to avoid polluting a backend database with bad data. HTML validation is done server-side to avoid confusing a web browser with bad HTML output (this promotes fast page rendition too!). For security reasons, I put sensitive business logic on the server-side (or in the backend database!).
I have had many heated debates about whether this or that should be implemented in Java or JavaScript, but my answer is always the same: do it where it consumes the least bandwidth!
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.