Researcher question – what's the point of semicolons and curly braces?

Chris via Digitalmars-d digitalmars-d at puremagic.com
Tue May 3 11:37:54 PDT 2016


On Tuesday, 3 May 2016 at 03:48:09 UTC, Joe Duarte wrote:
> Hi all,
>
> I'm a social scientist and I'm preparing some studies on the 
> effects of programming language syntax on learning, motivation 
> to pursue programming, as well as any disproportionate effects 
> that PL syntax has on the appeal of programming to women (more 
> on the latter in a separate post).
>

Yes, please elaborate on this. I have to say I don't like the 
sound of this paragraph. Why would women be repelled by curly 
braces and semicolons? I know from my own experience that Python 
doesn't do the trick either. If a woman doesn't want to program, 
she just doesn't want to, even if it's in Python. It's the term 
"programming" that makes them (i.e. those who are not interested) 
run away. "Write a script" sounds nicer, but even then ... if 
they don't have to they won't even touch it with thongs.

Men who are not really interested in techie stuff also run away 
when they hear the word "programming". The syntax is not really 
the issue. It's programming itself.

>
>
> Would it be difficult to compile the clean version? Would there 
> be issues with the design of the lexer/parser? I assume the 
> compiler would recognize keywords like return (and a clean 
> syntax could drive different rules for what statements and 
> expressions could appear on the same line and so forth).

[snip]

D has quite a clean syntax, imo. It looks "agreeable" on the 
page. Python, although it prescribes line breaks and indentation, 
can be very hard to read, even short scripts can get messy when 
you lose track of the indentation level. Mind you, Python's 
prescriptive formatting was designed to force non-programmers 
(e.g. scientists and researchers who want to write scripts) to 
write clean code. It is a pedagogical thing more than anything 
else. I believe that formatting (i.e. how it looks on the page) 
should not be part of the language itself. Any programmer in his 
or _her_ right mind will come up with some sort of structured 
formatting of their source code anyway. But it should not be a 
language feature.

I've often been annoyed by Python's error messages regarding the 
wrong indentation level, only because I cut/copied and pasted a 
block of code. With braces that cannot happen. The thing is that 
in Python you have to do all the correct formatting for trivial 
bits of code you just need for testing/debugging. Now, if you 
find out that you don't want/need the bit of code anymore (say 
after a few minutes), you've wasted your time formatting it. Very 
annoying.

Walter's point about redundancy are interesting. Much like in 
natural languages, the more redundancy, the less ambiguity.

I think in a few years, vintage C-style will be _the_ big thing 
again.


More information about the Digitalmars-d mailing list