Everything2
Near Matches
Ignore Exact
Full Text
Everything2

Languages in which whitespace is significant

created by ariels

(thing) by ariels (3.9 d) (print)   ?   (I like it!) Sat May 13 2000 at 15:08:46

One way in which a computer language can be evil is to have it treat whitespace in a special manner. The normal way of dealing with whitespace is to treat all sequence of whitespace characters the same way (as some kind of token separator, usually). Languages which do otherwise are often a pain to program in. Some little languages (like command shells) are justified in doing this (it is expected that the end of the line will terminate a command!). But it's almost never OK to make specific demands for horizontal whitespace (spaces and tabs). Amazingly, people are still performing this crime against ASCII!

Here's an incomplete list of the offendors:

Fortran
Horizontal whitespace is completely removed from your program! So you can say "GO TO" for "GOTO", but also
       DO 100 X=1.10
might not do what you think it does (note that's a period, not a comma!).
Haskell
Horizontal whitespace is used to specify block structure. However, a sane alternative (of using braces {...} to delimit blocks) is provided, but looks a bit funny.
Python
Horizontal whitespace must be used to specify block structure. Yuck.
Make
A very special type of horizontal whitespace must be used for command lines in the makefile: the first character of the line must be a TAB. Even 8 spaces won't work, but they'll look the same on your screen. Failing to do this leads to "amusing" errors.

I'm sure many more examples of this idiocy exist...

(idea) by McSnarf (6.3 mon) (print)   ?   (I like it!) Sat Jul 14 2001 at 22:16:01

A language like FORTRAN is also problematic if you need to write a parser/compiler for it.

The well-known assignment mentioned above (DO10I=1.10) is as awful as something like IF(1.EQ.J) - as you have to look ahead in your input stream. Continuation cards make things even worse - so do lesser-known facts ( every character but space and 0 are continuation characters). Besides, being able to write CO N T IN UE instead of CONTINUE is not something you'd ever need - nor is it helpful to spread "STOP" on four lines using continuation characters.

With Fortran 77, first compilers appeared which were less strict when it came to formatting (based on punched cards) and even allowed multiple statements on one line separated by a semicolon. (Besides, the use of INTEGER or LOGICAL arrays for character handling fell out of fashion with the introduction of CHARACTER).


(thing) by xmatt (2.2 mon) (print)   ?   (I like it!) 1 C! Thu Oct 04 2001 at 18:16:45

Japanese. Well, not all whitespace is irrelevant, but words in sentences are not required to be separated by spaces. In the kanji writing system, a word's function in the sentence is indicated by a particle (a very small word which proceeds it). Particles indicate objects and subjects of the sentence, as well as many notions that are expressed in English through prepositional phrases. When kanji is written horizontally as western languages are, periods and spaces are used as in English to denote the end of sentences. However (although I'm not entirely sure about this), no periods or spacing are required when using the antiquated, stylistic vertical method of writing kanji.

printable version
chaos

whitespace World's most flexible programming language Getting slapped in the nuts from behind White space is not a tool of the Devil
People with programming languages named after them It's all right to be filled with hate, people are stupid Python sXe
Haskell FORTRAN What You Leave Behind Workplace Shell
Dictionaries prove nothing .GT. Finnish words for snow goto
Taking over the world with a Tesla coil g77 Programming E2 node autolinker in perl
Defense Language Institute make Vertical Tab Sex reassignment surgery
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Things you could have written:
The War of the Worlds
Carnal Harvest
The Happy Prince
The crack whores vs. hellfire
Kings Cross by Coke-light
Stonewall Riots
Nobel Prize in Literature
President of the United States of America
This is just pure cool! It's cryptic, mystical, lovely. I had no choice!
It will be in Georgia. It will be Taipei.
Poetry you found that you wrote when you were ten but secretly still like
Joey Bishop
New York subway
New Writeups
LostPsion
"Shut the Fuck Up" Theaters(idea)
Vanish
The line between normal and not(place)
beatrice
You've been slowly taking me over for nearly a year, do you know that?(idea)
Berek
YouTube(thing)
shaogo
How to Pretend to Have a Job(idea)
hapax
Les Provinciales(review)
zoeb
The Scene(review)
aneurin
Telephone Numbers for drama purposes(idea)
Alnilamski
Cosmicopolis(fiction)
eien_meru
measure(idea)
Dreamvirus
pussy willow(thing)
czeano
Three "T"s(idea)
UncleM
Vantage Point 2: Fractal Thread Count(idea)
LostPsion
First Fiction: Night(fiction)
Lysander Peregrine
How to Pretend to Have a Job(idea)
Everything 2 is brought to you by the letter C and The Everything Development Company