November 30, 2006
Daniel Giddings wrote:
> Get an editor that understands Python ;-) Most will either use whatever that code block uses, or highlight the problem indentation in bright red.
> 
> Personally I much prefer the Python way of doing indentation, after all you indent your code anyway making the curly braces somewhat redundant (and I program about equally in C/C++ and Python).

I use Python occasionally, and the indentation requirements have never bothered me.

But, from what I've heard, web programming is a huge pain in the ass using Python. Embedding Python source in an HTML document (php/jsp style) causes major pain, since whitespace matters within python blocks.

--benji
November 30, 2006
I've not done any web programming presentation wise, except using Zope (a Python application server for building web apps). I can see where JSP style programming would be a problem with Python.

Zope takes the approach of using a templating language for seperating presentation with back end logic. It's a far better approach than embedding code into a web page. Your graphics designers can take the pages directly into dreamweaver / whatever and see sample values in the dynamic fields, and modify it without having to worry about broken html due to <% %>.

Zope Page Templates:
http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixC.stx

:-) Dan

Benji Smith wrote:
> Daniel Giddings wrote:
>> Get an editor that understands Python ;-) Most will either use whatever that code block uses, or highlight the problem indentation in bright red.
>>
>> Personally I much prefer the Python way of doing indentation, after all you indent your code anyway making the curly braces somewhat redundant (and I program about equally in C/C++ and Python).
> 
> I use Python occasionally, and the indentation requirements have never bothered me.
> 
> But, from what I've heard, web programming is a huge pain in the ass using Python. Embedding Python source in an HTML document (php/jsp style) causes major pain, since whitespace matters within python blocks.
> 
> --benji
December 01, 2006
Benji Smith wrote:
> But, from what I've heard, web programming is a huge pain in the ass using Python. Embedding Python source in an HTML document (php/jsp style) causes major pain, since whitespace matters within python blocks.

Every programming language has some stupid mistake in it that sounded like a good idea at the time:

C: pointer-array equivalence
C++: using < > for templates
Python: spaces mean something
Java: exception specifications
Lisp: ( )
FORTRAN: DO 10 I
Pascal: I/O is a special case
D: I'm sure you all have your own ideas for this!
December 01, 2006
Walter Bright wrote:
> Benji Smith wrote:
> 
>> But, from what I've heard, web programming is a huge pain in the ass using Python. Embedding Python source in an HTML document (php/jsp style) causes major pain, since whitespace matters within python blocks.
> 
> 
> Every programming language has some stupid mistake in it that sounded like a good idea at the time:
> 
> C: pointer-array equivalence
> C++: using < > for templates
> Python: spaces mean something
> Java: exception specifications
> Lisp: ( )
> FORTRAN: DO 10 I
> Pascal: I/O is a special case
> D: I'm sure you all have your own ideas for this!

:-)

For me, I think it's too soon to tell. After all, we're still living the "at the time" part with D.

Right now I'm actually more satisfied with D than ever!
December 01, 2006
Georg Wrede wrote:
> Walter Bright wrote:
>> Benji Smith wrote:
>>
>>> But, from what I've heard, web programming is a huge pain in the ass using Python. Embedding Python source in an HTML document (php/jsp style) causes major pain, since whitespace matters within python blocks.
>>
>>
>> Every programming language has some stupid mistake in it that sounded like a good idea at the time:
>>
>> C: pointer-array equivalence
>> C++: using < > for templates
>> Python: spaces mean something
>> Java: exception specifications
>> Lisp: ( )
>> FORTRAN: DO 10 I
>> Pascal: I/O is a special case
>> D: I'm sure you all have your own ideas for this!
> 
> :-)
> 
> For me, I think it's too soon to tell. After all, we're still living the "at the time" part with D.

That's what I think, too. In 10 years we'll all know what is screwed up in D. At least we got rid of the bit type before it got too entrenched!

> Right now I'm actually more satisfied with D than ever!

Perspective is a funny thing. Many years ago, the appliances in my kitchen were old and cruddy, and I thought it might be time to do a kitchen remodel. So I hired this high end kitchen design outfit. They came in, and designed an absolutely stunning kitchen. So I showed the design to my dad. He told me I'd be sorry if I went ahead with the project, because the kitchen would look so good the rest of the house would look like garbage. Whereas I was satisfied with the rest of the house, I wouldn't be after the remodel. I think he was right, and I canceled the project.

So how does this relate to D? The best compliment on D I received a while a go started by cussing me out. The person had used D for a while, and then went back to C++. He found that whereas he was perfectly happy with C++ before, he couldn't write C++ any more. D had ruined his taste for it <g>.

December 01, 2006
Walter Bright wrote:
> Perspective is a funny thing. Many years ago, the appliances in my kitchen were old and cruddy, and I thought it might be time to do a kitchen remodel. So I hired this high end kitchen design outfit. They came in, and designed an absolutely stunning kitchen. So I showed the design to my dad. He told me I'd be sorry if I went ahead with the project, because the kitchen would look so good the rest of the house would look like garbage. Whereas I was satisfied with the rest of the house, I wouldn't be after the remodel. I think he was right, and I canceled the project.
> 
> So how does this relate to D? The best compliment on D I received a while a go started by cussing me out. The person had used D for a while, and then went back to C++. He found that whereas he was perfectly happy with C++ before, he couldn't write C++ any more. D had ruined his taste for it <g>.
> 

I can relate to the poor guy.  I started out, many a moon ago, bashing out BASIC/1a on a Trash-80.  (Model 4P, for those who know.)  Took a course on C/C++ in high school, went along with that for a few years.  Then took up Java because, at the time, I was doing mostly very small GUI convenience apps.  Then (gosh, has it been that long?) I came across D (0.49).  (Don't even remember how I found it!)  I played around with it, doing random silly things for a week or two, and put it aside.  About that time, I took a little vacation, so to say... I did peek back every now and then at the change log, just to see if that "interesting little language idea was going anywhere."  Come 0.63, I 'converted' and haven't looked back since.  I wanted so badly to get away from Java's VM-hell (yes I know, its all improved vastly over time, but still) but just couldn't swallow C++ at all anymore, I'd actually started pondering on my /own/ new language idea... just to realize I was practically making a substandard D anyhow.

-- Chris Nicholson-Sauls
December 01, 2006
Witold Baryluk wrote:
> Dnia Fri, 27 Oct 2006 12:15:48 +0000 (UTC)
> Charles Fox <charles@SPAMMENOT.robots.ox.ac.uk> napisał/a:
> 
> 
>>I've been following D for a few years now, and I'd like to suggest
>>ditching the (now completely redundant) curley brackets from the
>>C-like syntax and borrowing Python's use of tabs to replace them.   I
>>see no reason to keep the curley brackets now we have nice editors
>>that know about (and can display) tab characters.  The ideal
>>programming language should have no redundancy, you shouldn't have to
>>say anything twice, and at present we are still repearting ourselves
>>with both curley brackets and indentation!  What do you think?
> 
> 
> Hi all.
> 
> Try this:
> http://smp.if.uj.edu.pl/~baryluk/d/dmt-1.0.tar.gz
> 
> Note: not tested well (it is very simple and naive, but can be used for
> tests. but to be usefull some issues should be resolved in future).
> 
> 
> --
> Witold Baryluk
> MAIL: baryluk@smp.if.uj.edu.pl, baryluk@mpi.int.pl
> JID: movax@jabber.autocom.pl

Question: how do you propose to do these with only indentation:

> extern(C):
> << Butt-loads of non-indented code because indenting a whole file four
>    spaces is stupid >>

Or this:

> FunkyThing(some_expression,
> {
> 	<< More Code >>
> });

(Walter, can we *pretty please* have trailing delegate literals? *puppy-dog eyes*)

Or even THIS (which Python to this day cannot do):

> do
> {
> 	<< code >>
> }
> while( expression );

There's no way to indent the above that makes sense.

You say that we are repeating ourselves with indentation and curly braces... but that's not always true.  Take the following:

> class Foo
> {
> public:
> 	<< Public members >>
>
> private:
> 	<< Private members >>
> }

Here I'm *not* repeating myself.  I'm deliberately altering the indentation because losing eight characters on the side of every line of code just to make room for access modifiers is stupid.  Here's another real-life example:

> for( int i=0; i<WIDTH; i++ )
> for( int j=0; j<HEIGHT; j++ )
> {
> 	<< Code >>
> }

I've broken convention there to emphasise that this is a 2D traversal across a rectangular array.

The curly brace syntax is NOT redundant.  It's just different.  Please stop being syntaxist -- all syntaxes are created equal!

... except for APL.  That's like vomiting random unicode code points onto a piece of paper and calling it code.  Oh, and LISP.  But then, that's not really a syntax so much as a file format for S-expressions that happens to be executable :3

	-- Daniel "has far too many 2c coins lying around"

P.S.  Just so you know, I love Python's syntax.  I just don't think it's suitable for D. :)
December 01, 2006
Kyle Furlong wrote:
> Tomas Lindquist Olsen wrote:
>> Mark Wrenn wrote:
>>>
>>> I must be old :)  I have to say that I like the C style brackets.  I'll
>>> catch you guys later at the old programmers home :)
>>>
>>> Mark
>>
>> I'm not old and I like the brackets too
> 
> Likewise

Ditto. I'm by no means old yet I'm a fan of braces. I'll admit that BSD/Allman style annoys me (it wastes a bit -too- much space for my liking) but following K&R in general results in fairly neat, legible code without too much waste.

Sure, there's even less space "wasted" if you remove braces altogether, but it's not true to say that there is no longer any justification for them: tabs vs. spaces problems still plague some such languages (though this is generally a minor concern) and removing braces kills flexibility! I couldn't count the times I've needed to break convention to lay some special code out in a more sensible way.
December 01, 2006
Daniel Giddings escribió:
> Get an editor that understands Python ;-) Most will either use whatever that code block uses, or highlight the problem indentation in bright red.
> 
> Personally I much prefer the Python way of doing indentation, after all you indent your code anyway making the curly braces somewhat redundant (and I program about equally in C/C++ and Python).

And I found all the people who don't like indent blocks is people that doesn't use them for too long. Sure at first is horrible, shocking, but when you get used to, there's no way back.

Bracket (and sentence terminators) are syntactic noise[1].

[1] http://xlr.sourceforge.net/concept/synnoise.html

-- 
Leandro Lucarella
Integratech S.A.
4571-5252
December 01, 2006
Dnia Fri, 01 Dec 2006 13:33:05 +0800
Daniel Keep <daniel.keep+lists@gmail.com> napisał/a:

> Question: how do you propose to do these with only indentation:
> 
>  > extern(C):
>  > << Butt-loads of non-indented code because indenting a whole file
>  > four spaces is stupid >>
> 

You can't do this in simple/automatic way. "Indented D" (if i can name
it so) is for other purpose - for quick & dirty scripting, accessing
library function, not creating them. Of course, we can create
rules, so all of D constructs will be possible/allowed, but probably
there will be lots of such rules. In hard cases I like strong syntax
discipline, and if there is any notstrict construct it is an error.

> Or this:
> 
>  > FunkyThing(some_expression,
>  > {
>  > 	<< More Code >>
>  > });
You can, or we can adapt backslash (like in bash) to do this:
FunkyThing(some_expression, \
{ \
	<< More Code >> \
}); \

I know, it is awful. Another proposition can be:
Implicit { introduce additional indentation level inside.
So it will be like:
FunkyThinkg(some, \
{
   xx
   if y:
     z
})


> Please stop being syntaxist -- all syntaxes are created equal!
:)

BTW. Whitespace also?

> P.S.  Just so you know, I love Python's syntax.  I just don't think it's suitable for D. :)
I also like Python's syntax, but i think small portion of D can be
adapted to this syntax (if anyone like tabs, and if it will be used
by anyone). I also think that people frustrated by Python syntax,
simply have bad editor/configuration. Lots of editors now is not tabaware.

PS. I use in all languages (Python, C, D, etc.) hard-tabs (for
indentations), which are displayed as 4-character in my
editor. There are simple rules to be consistent with such style, and not
introduce problems in any situation.


-- 
Witold Baryluk
MAIL: baryluk@smp.if.uj.edu.pl, baryluk@mpi.int.pl
JID: movax@jabber.autocom.pl