Jump to page: 1 24  
Page
Thread overview
suggestion
Mar 10, 2004
imr1984
Mar 10, 2004
J Anderson
Make Semicolons optional - WAS: suggestion
Mar 10, 2004
imr1984
Mar 10, 2004
J Anderson
Mar 10, 2004
Charles Hixson
Mar 10, 2004
Manfred Nowak
Mar 10, 2004
Ant
Mar 10, 2004
Andy Friesen
Mar 10, 2004
Ant
Mar 10, 2004
Julio Jiménez
Mar 10, 2004
Ant
Mar 10, 2004
Julio Jiménez
Mar 10, 2004
Ant
Mar 10, 2004
Julio Jiménez
Mar 10, 2004
Ant
Mar 10, 2004
Julio Jiménez
Mar 11, 2004
Ant
Mar 10, 2004
C. Sauls
Mar 10, 2004
Ilya Minkov
Mar 12, 2004
Phill
Mar 13, 2004
J C Calvarese
Mar 13, 2004
Phill
Mar 10, 2004
Stewart Gordon
Mar 10, 2004
Juan C
Mar 10, 2004
Stewart Gordon
Mar 11, 2004
Alex Fitzpatrick
Mar 11, 2004
kinghajj
Mar 11, 2004
Alex Fitzpatrick
Mar 11, 2004
Walter
March 10, 2004
the other day i was studying assembly programming, and it struck me - why does D need semicolons after statements at all? they seem like a waste of time.

I think statements should be seperated by new lines OR semicolons, so that existing D code will still work.

Ive been programming C style languages for years now and i still often forget a semicolon - so i think this would be a big time saver, as well as making the code more readable


March 10, 2004
imr1984 wrote:

>I think statements should be seperated by new lines OR semicolons, so that
>existing D code will still work.
>  
>
I agree, although I'd still like to use semicolons now-and-then, having them optional would be great.

-- 
-Anderson: http://badmama.com.au/~anderson/
March 10, 2004
cool - someone agrees with me :) Walter what do you think?

In article <c2n4nj$m6p$1@digitaldaemon.com>, J Anderson says...
>
>imr1984 wrote:
>
>>I think statements should be seperated by new lines OR semicolons, so that existing D code will still work.
>> 
>>
>I agree, although I'd still like to use semicolons now-and-then, having them optional would be great.
>
>-- 
>-Anderson: http://badmama.com.au/~anderson/


March 10, 2004
J Anderson wrote:

> imr1984 wrote:
>
>> I think statements should be seperated by new lines OR semicolons, so that
>> existing D code will still work.
>>  
>>
> I agree, although I'd still like to use semicolons now-and-then, having them optional would be great.
>
I would also: add that semicolons are just another small redundancy (most of the time) for the programmer.  Removing redundancies makes code just a little bit easier for coders.

-- 
-Anderson: http://badmama.com.au/~anderson/
March 10, 2004
imr1984 wrote:

[...]
> I think statements should be seperated by new lines OR semicolons, so that existing D code will still work.
[...]

Ouch! You forgot to introduce the line continuation character. I am used to see function calls formatted over several lines.

More extensions in the c-- style?

So long.
March 10, 2004
On Wed, 10 Mar 2004 13:16:35 +0000, imr1984 wrote:

> the other day i was studying assembly programming, and it struck me - why does D need semicolons after statements at all? they seem like a waste of time.
> 
> I think statements should be seperated by new lines OR semicolons, so that existing D code will still work.
> 
> Ive been programming C style languages for years now and i still often forget a semicolon - so i think this would be a big time saver, as well as making the code more readable

Once I designed and implemented a language
(mix of C and Pascal see past posts)
and it didn't had any statment separators.

int f(int i)
{
   f = i * 2
}
int a int b a=1 b=2 a = a + b * f(b) + 47

there is no confusion there!

the prove that the semicolon aren't needed is that the compiler can warn you when they are missing

I just convinced dmd to produce the message:

"semicolon expected, not 'public'"

I see the semicolon as a control so that both
the human and the compiler are sure they are
talking about the same thing.

a = b f()

that would be valid and interpreted (on my language) as

a = b;
f();

but you might wanted to say

a = b + f();

and now for a missing key stroke
you have a bug...

let's keep them.

now the IDE might help you to put a semicolon
at the end of the line (I'm NOT planing that for leds).

eclipse JDT goes half way:
when you press ";" anywhere on the line
it will placed at the end of the line
(this for sure would be good on leds).

Ant

March 10, 2004
imr1984 wrote:

> the other day i was studying assembly programming, and it struck me - why does D
> need semicolons after statements at all? they seem like a waste of time.

They make the parser easier to implement, basically.

> Ive been programming C style languages for years now and i still often forget a
> semicolon - so i think this would be a big time saver, as well as making the
> code more readable

Python does exactly this.  When the parser encounters an open bracket/brace/parenth, it ignores newlines until it's closed.

a = b +
    c     // no good, need a \ at the end of the previous line

a = (b +
     c)   // ok

blah(a, b,
     c)   // also ok

a = b
    + c   // Legal, but probably not what the programmer means!

While I think it's the Right Thing, this could really throw off C coders who are used to whitespace being completely ignored.

 -- andy


March 10, 2004
imr1984 wrote:
> the other day i was studying assembly programming, and it struck me - why does D
> need semicolons after statements at all? they seem like a waste of time.
> 
> I think statements should be seperated by new lines OR semicolons, so that
> existing D code will still work.
> 
> Ive been programming C style languages for years now and i still often forget a
> semicolon - so i think this would be a big time saver, as well as making the
> code more readable

I personally find the semi-colons rather useful when needing to split a really large statement over several lines. If you've ever programmed using the Windows API you will know what I mean. (Someone ought to be shot for that festering turd of an API.) The first programming language I used (and discarded) was Visual Basic, which used newlines for statement separation. There you needed to use an underscore (IIRC) to join several lines into one statement. I don't know, it's possibly a matter of taste, but I prefer the semicolons. Yes, I forget them from time to time, but the compiler will notify me when it hits something else when its expecting a semi-colon, so it's not a problem.

Hmm. FYI, and because I'm waiting for my downloads to end (never happens). The most annoying syntax error I tend to make is when I forget to close a literal string somewhere. Mind, I only do this when I use PHP - never had this problem elsewhere, probably because I use less literal strings elsewhere. At any rate, while PHP tends to output fairly good error messages (certainly better than any other "compiler" I've ever used including dmd at the moment, but hopefully not forever(?)) in this case it just cannot figure out the whereabouts of the error, so I usually end up checking ever singly literal string I've written. (I should really run scripts/compile a lot more often, it's a bad habit of mine to write 200-400 lines and *then* sort out all the errors, just to finally find that the logic is broken, and then I can't find it.)

Uh. That makes me look like a worse programmer than I (think I) am :-o

Cheers,
Sigbjørn Lund Olsen
March 10, 2004
On Wed, 10 Mar 2004 16:11:01 +0100, Sigbjørn Lund Olsen wrote:

>The most annoying syntax error I tend to make is when I forget
> to close a literal string somewhere.

(Ah! another opportunity to talk about leds.)

leds will highlight unclosed literals with a different color.
(This is standard on Scintilla)

Ant

March 10, 2004
It would raise the ambiguity even further. While languages like Python (which has line-based formatting) and Eiffel (which ignores line ends, but semicolons are optional) can afford that, i think C-like languages cannot. This would cause too much ambiguity and lead to even more stupid bugs! Don't you have enough of ambiguities?

Don't see how it would be besser to readability.

-eye


imr1984 schrieb:

> the other day i was studying assembly programming, and it struck me - why does D
> need semicolons after statements at all? they seem like a waste of time.
> 
> I think statements should be seperated by new lines OR semicolons, so that
> existing D code will still work.
> 
> Ive been programming C style languages for years now and i still often forget a
> semicolon - so i think this would be a big time saver, as well as making the
> code more readable
> 
> 
« First   ‹ Prev
1 2 3 4