Article View: comp.lang.misc
Article #6751Re: Anyone want to design a language?
From: Raymond Chen
Date: Tue, 20 Feb 1990 02:59
Date: Tue, 20 Feb 1990 02:59
62 lines
2541 bytes
2541 bytes
[I regret that I have but one line to give for my...MUNCH]
One of the few things I like about Pascal is its rigid typing.
If I have defined [using C-style notation]
typedef int xcoord;
typedef int ycoord;
typedef int attrib;
void put_as_at(char c, attrib a, xcoord x, ycoord y) { ... }
then it would be nice if the compiler would flag
{ xcoord x; ycoord y; char c; attrib a;
foo(y,x,a,c);
}
as potentially erroneous (A warning is fine). It's amazing how many
stupid errors are caused by passing parameters to a function in the
wrong order. (And yes, of course, there should be a way to tell
the compiler "No, really, I know what I'm doing, trust me.")
Would also be fun if I could invoke the function above as
put c as a at (x,y)
^^^ ^^ ^^ <- these guys are the function name
(In the never-ending quest to make pseudo-code a proper computer language!)
As for using indentation to indicate block structure: This can lead
to ridiculous code when your indentation marches off the edge of the
paper. It also could create entries into the Obfuscated [language-name]
Code Contest like this:
foo(a,b,c)
if blah
while blah
for blah
if blah
for blah
while blah
if blah
for blah
if blah
while blah
if blah
grumble
blurfle // guess what indentation level this is at!
bar(x,y,z) // this too. Is it a function call or
// a function declaration?
Apart from having immense fun with indentation, it also causes problems
if you cut and paste a clump of code from one place to another if the
destination has a different indentation level from the source.
If my memory serves me right, this experiment with "indentation determines
block structure" was used in a Pascal dialect many years ago. I don't
remember what eventually happened to it.
--
raymond@math.berkeley.edu mathematician by training, hacker by choice
Technical Details
Message-ID:
<1990Feb20.025947.16211@agate.berkeley.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!twinkies!raymondReferences:
<22569:05:10:24@stealth.acf.nyu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!agate!twinkies!raymond From: raymond@twinkies.berkeley.edu (Raymond Chen) Newsgroups: comp.lang.misc Subject: Re: Anyone want to design a language? Message-ID: <1990Feb20.025947.16211@agate.berkeley.edu> Date: 20 Feb 90 02:59:47 GMT References: <22569:05:10:24@stealth.acf.nyu.edu> Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44) Reply-To: raymond@math.berkeley.edu (Raymond Chen) Distribution: usa Organization: U.C. Berkeley Lines: 62