473,790 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"correct" tab/space rule? (prothon)

Ville Vainio came up an idea for one final tweak of the tab/space indent
algorithm we are using in Prothon, and the final result surprised me, in
that it directly addresses the problem of mixed tabs and spaces. We have
been having flame wars about tabs vs. spaces and I was thinking this was an
opinion kind of thing and it never occured to me to look at it as a simple
bug that needed fixing. Give me a second of your time to pitch it that way.

When you mix tabs and spaces in Python and you change the tab width in your
editor, the indents don't visually line up any more, even thought it
compiles fine. This is the bug/problem. If you just don't allow tabs and
spaces to be mixed in any one block, where you define a block to be a group
of matching indented lines, then this problem cannot occur and the bug
cannot occur.

Our new Prothon rules fix this problem while allowing maximum flexibilty to
use both tabs and spaces, and we've thrown in a new easier continuation
method just for good measure.

Prothon indentation rules:

1) You must use only tabs or only spaces for indents in any one indentation
block. You cannot mix tabs and spaces in a block. A block is defined as a
group of consecutive indented lines. Non-indented lines seperate blocks.

2) Each indent level can have any number of characters more than the
previous level, whether you are using tabs or spaces. If you drop back to
the left to dedent, and your column position does not match any level above,
you will get a lexer error.

3) If you increase the indentation level above the previous line by even
one character, and that previous line does not end in a colon, then the new
line will be considered a continuation of the previous line.

4) If a line contains an active (not quoted or commented) (, {, or [
without a matching end character, then the following line is always a
continuation, no matter what that following line contains.

5) There is still support for using the trailing backslash ( \ ) to indicate
that the next line is a continuation. This may be removed in the future if
everyone agrees to do so.

6) A continuation line is effectively added to the end of the previous line
so any line following a continuation line uses the last non-continuation
line for the "previous line" in all the rules above.
Jul 18 '05 #1
0 1353

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

Similar topics

2
7910
by: CLEAR-RCIC | last post by:
Hello All, I wrote a .dll that programatically maps two network drives and copies files from one drive to the other. The .dll works fine when using an .exe to call the .dll. When I call the .dll with a Windows Service I get the following error - "The specified network password is not correct". This makes no sense as both the .exe and the Windows Service are both run from my machine. I also specify my domain account/password in the...
53
4606
by: Alf P. Steinbach | last post by:
So, I got the itch to write something more... I apologize for not doing more on the attempted "Correct C++ Tutorial" earlier, but there were reasons. This is an UNFINISHED and RAW document, and at the end there is even pure mindstorming text left in, but already I think it can be very useful. <url: http://home.no.net/dubjai/win32cpptut/special/pointers/preview/pointers_01__alpha.doc.pdf>.
3
304
by: Mitchell Vincent | last post by:
I've been somewhat confused about what the "proper" place is to store data files (like file based databases) for my applications. With all the different "special" folders available, which is the correct one for databases that get updated every time a user runs the application? I need to make sure that Windows 98 users can use my software as well, but I also need make sure that the data file is always accessible at a consistent location...
50
6083
by: Shadow Lynx | last post by:
Consider this simple HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Strict kills my widths!</title> </head> <body> <table style="width:400px; table-layout:fixed;">
4
1479
by: metaperl | last post by:
I work at a place which is currently running SQL 2000, but they are planning to migrate to 2k5. I was thinking that this is the perfect opportunity to fix all the weaknesses we have had in our data model for the longest: primary keys and foreign keys with different names, use of character columns for boolean fields, use of integer columns for toggles, no referential integrity, etc. So, even if I create my Utopian perfect data model and...
4
2492
by: chaitu | last post by:
Hi guys, I've written a parallel build program (in Perl) that takes a pre-computed dependency tree of many projects in 2 visual studio .net 2003 solution (.sln) files here at my company, and builds projects at a same level of dependency parallelly. While doing this, sometimes I get "Microsoft Visual Studio experienced some errors and needs to close" pop-up (which was gone after I disabled error-reporting for programs from Control...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.