473,320 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ECMAScript syntax

Does the "semicolon insertion" really affect you if you format code as

function x (y)
{
// ...
}

instead of:

function x (y) {
// ...
}

The jslint page complains about lines ending in ) due to the nebulous
idea of "semicolon insertion". I have not reviewed the ECMAScript pdf
in great detail to try to pin this pretty-printing issue down. In
general, I find that code formatted in the "K&R" style (opening brace
on same line as if, while, function) confusing and difficult to read
compared with placing curly braces on separate lines.

On another subject, the difference between inner functions defined
explicitly versus defined using function expressions seems like a good
one for a FAQ. Under what circumstances does it make a real
difference whether you use function expression versus function
statement versus Function object?

/Joe
Jul 20 '05 #1
1 1525
> Does the "semicolon insertion" really affect you if you format code as

function x (y)
{
// ...
}

instead of:

function x (y) {
// ...
}

The jslint page complains about lines ending in ) due to the nebulous
idea of "semicolon insertion". I have not reviewed the ECMAScript pdf
in great detail to try to pin this pretty-printing issue down. In
general, I find that code formatted in the "K&R" style (opening brace
on same line as if, while, function) confusing and difficult to read
compared with placing curly braces on separate lines.


I like to avoid insecurities in languages. I prefer to work where the ice is
thickest. Since I am the one who wrote jslint, that's what it likes, too. But it
has a checkbox that you can clear that turns off that check.

Legibility is of paramount importance. If you find the K&R convention difficult
to read, then don't use it. One of the deficiencies of the C family is that
there is no ideal way to make them pretty. I think that should be an important
consideration in the design of syntax, but clearly I am not with the mainstream
on this.

http://www.crockford.com/javascript/lint.html

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
by: manno | last post by:
Hi all, more or less just out of curiosity... I had a short 'discussion' about JavaScript in different borwsers. The other guy said that there's differeces in JavaScript accross browsers (I...
12
by: Ali | last post by:
I have the following web page with a script in it. <html> <head> <title>Make Your Own Objects test</title> <script>
2
by: Lachlan Hunt | last post by:
Hi, In JavaScript 1.5, objects can use special getter and setter functions for properties. However, these only seem to be implemented in Gecko and, AFAICT, don't seem to be part of ECMAScript. ...
12
by: Simula | last post by:
Hello All, Does anyone have any knowledge of when version 4 will be released? I think that version 3 was finalized in 1999 and it would be really nice to have the class keyword and statically...
2
by: bissatch | last post by:
Hi, I am one of the many that get fed up with browser sniffing and cross platform issues. Is ECMAscript a new independant cross platform specification that can do loads of nice things that...
2
by: VK | last post by:
2.12 What does the future hold for ECMAScript? <old> The fourth edition of ECMAScript will provide new features like typed variables, and classes. More information can be found at:...
4
by: Academia | last post by:
Regex class has the option ECMAScript which can set. I searched the Internet and got about a million hits that reference ECMAScript but none that defined it. Can you tell me what it is used...
34
by: dhtml | last post by:
I made a change to the FAQ of javascript to EcmaScript. I got some feedback that the newsgroup is CLJ and the language is commonly referred to as JavaScript. Therefore, the word in the FAQ...
4
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - What is ECMAScript? ----------------------------------------------------------------------- ECMAScript is the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.