|
While in general I agree with you, as a language designer it is easy to fall into the trap of saying that spaces and page layout don't matter. This makes a fragment like:
i
n
t
e
g
e
r
p
r
o
c
e
d
u
r
e
f
a
c
(
n
)
;
v
a
l
u
e
n
;
i
n
t
e
g
r
n
;
f
a
c
:
=
i
f
n
=
0
t
h
e
n
1
e
l
s
e
n
*
f
a
c
(
n
-
1
)
;
a legal Algol program. The truth is probably somewhere in between.
(Algol program taken from D.W.Barron - An Introduction into the Study of Programming Languages)
Mircea
|
|
|
|
|
On the other hand... allowing the developer to format his code as he likes is better than requiring the developer to format his code a certain way.
For the most part, C-like languages don't even require line breaks, which makes code generation much easier.
modified 21-Oct-22 12:09pm.
|
|
|
|
|
True enough! See the bad example of Go where you must place the brace on the same line as if and else .
Mircea
|
|
|
|
|
Mircea Neacsu wrote: example of Go where you must place the brace on the same line as if and else. Hmm, apparently I am never going to use that language.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Well, it has features that make it a compelling choice in some cases. And to heck with it: I wrote programs in FORTRAN where you had to start in column 7 and place continuation mark in column 6. If I survived that, I'm sure going to survive a misplaced brace
Mircea
|
|
|
|
|
That's a tough one, you sir, have more patience than me.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
|
I thought Java and C# were mutual wannabes, he says, donning his asbestos suit.
|
|
|
|
|
Back in the day that was true…
Especially C# 1.0.
Very similar to Microsoft J#
Which was similar to Java.
This happened right after Microsoft and Sun had a big falling out about how Microsoft was “corrupting” Java.
If the disagreement had not happened, we likely would not have dotNet which is now multi platform like Sun always intended for Java. Sun/Oracle never would have bothered with templates except that dotNet had it.
I just find it fitting that Microsoft also copied the bad ideas from Java a la Silverlight/Applets.
|
|
|
|
|
No mention of copying GC?
|
|
|
|
|
Greg Utas wrote: No mention of copying GC? That's a bold claim. The Visual Basic language did garbage collection. Could you explain what you mean by the word "copying"?
|
|
|
|
|
There was a mention of C# copying bad ideas from Java, so I was surprised that GC wasn't mentioned.
|
|
|
|
|
Java didn't invent GC. Lots of other languages have it. Including C#. The fact that Java and C# have a common feature does not prove that C# copied it from Java.
Those who know the two GC implementations, and others as well, may identify specific elements in the C# GC handling that was pioneered in Java and not generally known in other GC mechanisms. That is (or might be) copying. But not the basic concept of GC.
|
|
|
|
|
I wasn't making a statement about which language was the first to have GC.
|
|
|
|
|
When I was reading the first spec for C# -- circa 1999 -- someone asked me, "isn't that the new Microsoft Java?" I have zero knowledge of Java, but C# is the bee's knees.
|
|
|
|
|
PIEBALDconsult wrote: For the most part, C-like languages don't even require line breaks, which makes code generation much easier.
I believe they do so in an implicit way by imposing lengths on a line. I used the following in google to find some references.
cfront maximum line length
c# maximum line length
I suspect this is essential because the compilers I have seen work on lines and not streams.
I have seen a C++ compiler fail because a method was too long (generated code.)
Java also imposes an explicit byte code limit on a method. Not sure about line limit but there are other limitations in the java classes which likely would limit the (realistic) size of the generated class file so I suspect there is some limit there also.
|
|
|
|
|
Using white space as part of the syntax is a huge potential source of errors, one that should simply not exist.
|
|
|
|
|
Most languages require a single space between types and variable names though.
Captain Pedantic strikes again.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
MarkTJohnson wrote: require a single space
Won't a TAB or other whitespace suffice?
|
|
|
|
|
If you want to completely tick off your coworkers.
String fred
= "The text";
Bah! Too much work to make really ugly code.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
Why is that a question? Shouldn't it be more emphatic, with a exclamation? It is for me!
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
I like the Python's power, libraries.
But yes, I wish to have a setting: Curly Braces= ON
|
|
|
|
|
Marc Clifton wrote: it's an interesting realization (to me at least) that my dislike of a language is often based on my dislike of the previous coder's code.
Admit it Marc, you just don't like anyone's code but your own.
I really, I wouldn't fault you for that. I'm the same way. I'm sure most are.
And yet we can't all be right at the same time. Hmmmm...
|
|
|
|
|
I bet you break your eggs on the big end too.
|
|
|
|
|
I don’t even like my code a few months on!
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|