Walter Bright:

>I couldn't find the posting. Can you provide a link please?<

I have spent something like an hour to find this (but I have not wasted this 
time, because as usual while looking for this post I have found something 
unrelated: two old bugs that I have shown in the D newsgroup that exist still, 
so I'll add them to Bugzilla soon later), and you are right. I think I have 
never written this idea in D newsgroups :-) Before giving some of my free time 
for the development of D I have given similar help for Python. So my post was 
there, six years ago, see point 12), sorry for my mistake:

http://groups.google.com/group/comp.lang.python/msg/93ce3e9a08f5e4c7
 
The point 12) was:

12) Mathematica's interactive IDE suggests possible spelling errors; this 
feature is often useful, works with builtin name functions too, and it can be 
switched off.
In[1]:= sin2 = N[Sin[2]]
Out[1]= 0.909297

In[2]:= sina2
General::"spell1": "Possible spelling error: new symbol name "sina2" is similar 
to existing symbol "sin2".
Out[2]= sina2

I don't know if some Python IDEs (or IPython) do this already, but it can be 
useful in Pythonwin. 

-----------------------

>I think there's a misunderstanding. The bit about semicolons in the article 
>was not about removing statement terminators, it was about the idea that a 
>statement termination can be inferred.<

I see and indeed I didn't understand well here. Thank you very much for 
explaining.


>What Python did was use a linefeed as the statement terminator rather than the 
>;. Python does not attempt to infer where they should go.<

Right.
In Python you need semicolons to separate commands if they are on the same line 
(but all Python style guides suggest to split this line):

x = 5; print x


>The redundancy is still there.<

Well, yes, there is the line termination still. But you can see that for the 
fingers of the programmer the redundancy in Python is lower.
Instead of three keys (on my keyboard I need shift for the semicolon):
<SHIFT>;<NEWLINE>
you have to type just one:
<NEWLINE>

This helps Python newbies and casual programmers (Python is often used as first 
language, so this is important), reduces typing a little, removes some syntax 
noise from the code, avoids missing semicolon errors (that are common in code 
written by programming newbies), etc. It's good for me too despite I am not a 
Python newbie.


>Javascript is fundamentally different in that it attempts to infer the 
>statement terminator.<

Right. And it seems Scala tries to do something related (even if Scala can be 
better on this too).


>So why does D have ; as a statement terminator? The simple answer is because D 
>is intended to have a low barrier for entry for C, C++, etc., programmers. The 
>familiar look & feel makes the new language less intimidating.<

Note that in Python ending semicolons are optional, if you use them there are 
no errors, I have personally seen several C/Java programmers write Python code 
this way and this causes zero problems:
x = 5;
print x;

And a C++ programmer scared by the fact that ending semicolons are optional? 
(This means such C++ programmer can write semicolons everywhere, and can find D 
code written by other people with no ending semicolons). Of all the mountain of 
syntactic mess the C++ is, I can't believe a normal C++ programmer can be 
scared by this :-) Of all the differences introduced by D over C++ this one 
seems minor.
D classes being reference values that must be allocated with a new looks like 
the more frequent cause of troubles for D newbies coming from C++.


>A personal answer is that I simply like it.<

OK.
My personal answer, is that I've written too many semicolons in my programming 
life, I prefer languages where I can avoid semicolons at the end of lines (if 
the language is well designed for this and doesn't infer anything. In 
JavaScript I want to use semicolons) :-)

Thank you for your answers,
bye,
bearophile

Reply via email to