Author Topic: Too many programming languages?  (Read 49240 times)

0 Members and 1 Guest are viewing this topic.

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Too many programming languages?
« Reply #275 on: November 26, 2019, 03:56:18 pm »
Even more stupid yet is to require indentation and indent with a character that's invisible...  >:D
The further a society drifts from truth, the more it will hate those who speak it.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14487
  • Country: fr
Re: Too many programming languages?
« Reply #276 on: November 26, 2019, 04:24:26 pm »
Require? One of the very few languages that *requires* indentation is Python. Talk about completely fucked. Of course there are so many Python lovers that they probably don't see any problem with this.

C, as most other languages, doesn't require indentation, nor any specific way of indenting. There are just coding styles. You can write however you see fit and that won't make a difference in the code itself. Indenting has been proven a simple and readable way of presenting code, so I don't see any problem using it, but it's certainly not "required".
 

Offline obiwanjacobi

  • Frequent Contributor
  • **
  • Posts: 988
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Re: Too many programming languages?
« Reply #277 on: November 26, 2019, 05:16:45 pm »
If you require indenting you can drop the {}'s. If you already think a ; is too much work, this should appeal to you!  ;D

The language I am designing (hobby project) also requires indenting in an effort to minimize the noise (characters)...
Arduino Template Library | Zalt Z80 Computer
Wrong code should not compile!
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Too many programming languages?
« Reply #278 on: November 26, 2019, 05:17:54 pm »
Require? One of the very few languages that *requires* indentation is Python. Talk about completely fucked. Of course there are so many Python lovers that they probably don't see any problem with this.
Yes, Python is what I had in mind when I was writing that. I don't think making whitespace significant is a good idea.
The further a society drifts from truth, the more it will hate those who speak it.
 
The following users thanked this post: SiliconWizard

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Too many programming languages?
« Reply #279 on: November 26, 2019, 05:21:33 pm »
If you require indenting you can drop the {}'s.

Yes, indentation lets you replace two characters with... tens, hundreds or even thousands. Good idea!
The further a society drifts from truth, the more it will hate those who speak it.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14487
  • Country: fr
Re: Too many programming languages?
« Reply #280 on: November 26, 2019, 05:24:51 pm »
If you require indenting you can drop the {}'s.

Yes, indentation lets you replace two characters with... tens, hundreds or even thousands. Good idea!

You also better have any "diff" tool you're going to use, well set-up. Because it's very common for those to ignore whitespaces by default. ;D
Oh, but I guess the big boys don't use diff tools?
 
The following users thanked this post: GeorgeOfTheJungle

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11653
  • Country: my
  • reassessing directives...
Re: Too many programming languages?
« Reply #281 on: November 26, 2019, 06:41:55 pm »
modern ide or text editor can do automated indentation, so we basically not typing it, or very less. but we dont have automated ";" and have to type it in every line of the codes. programmers have been willingly and happily to waste time and effort on this due to some ancient nomenclature.

If you require indenting you can drop the {}'s. If you already think a ; is too much work, this should appeal to you!  ;D
Basic have done that, but people still love wasting time. granted Basic is crippled-features such as no pointer and true OOP, so thats why its not gain popularity.
« Last Edit: November 26, 2019, 06:44:30 pm by Mechatrommer »
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Too many programming languages?
« Reply #282 on: November 26, 2019, 06:43:23 pm »
ancient nomenclature => bad ?
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 19517
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Too many programming languages?
« Reply #283 on: November 26, 2019, 06:45:15 pm »
Even more stupid yet is to require indentation and indent with a character that's invisible...  >:D

There's worse: having a significant difference between two invisible characters!

I remember swearing regularly when hand creating makefiles. It mattered whether the indentation was spaces or tabs.

Having used ASR33s and stored source code on paper tape, I can imagine how that came about.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11653
  • Country: my
  • reassessing directives...
Re: Too many programming languages?
« Reply #284 on: November 26, 2019, 06:46:50 pm »
ancient nomenclature => bad ?
just obsolete, some sort of "tele text command type machine?" i cant remember, but its not in existence today since decades...
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Too many programming languages?
« Reply #285 on: November 26, 2019, 06:54:52 pm »
ancient nomenclature => bad ?
just obsolete, some sort of "tele text command type machine?" i cant remember, but its not in existence today since decades...
And how old is the language you're writing in now?
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 11653
  • Country: my
  • reassessing directives...
Re: Too many programming languages?
« Reply #286 on: November 26, 2019, 07:01:40 pm »
we need the updated version, more powerful, not less, at least similar efficiency and features. i'm yet to find one. as simple as a upgrade to treat ";" to be similar to Line feed char (0A), (0D) carriage return can be ignored. hence ";" is not required if 0A is in place. how hard can it be? we dont need a new nor too many languages, just the "efficientest" one.
Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Too many programming languages?
« Reply #287 on: November 26, 2019, 07:06:17 pm »
But those two are invisible. Why are they better than ; ?
The further a society drifts from truth, the more it will hate those who speak it.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14487
  • Country: fr
Re: Too many programming languages?
« Reply #288 on: November 26, 2019, 07:38:25 pm »
There are also cases where splitting a statement over several lines can be useful. How do you do this without an end-of-statement token (such as ';')?
An example would be a calculation that doesn't fit on one line (or would be harder to read on one line only). If you don't have any end-of-statement token, you'll have to split the statement itself into several statements, thus actually requiring more keystrokes! (Because I guess the point against ';' is the extra keystroke.)

Oh well. I consider the amount of keystrokes to type an extremely MINOR factor when writing code. This is not where the crux of the work lies (and if it does for you, you'd probably need to seriously question your abilities or methods....)

But as I often say, purely stylistic issues can't be debated, so this is pointless. For those not liking the C syntax, use something else and be done with it.

 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: nz
Re: Too many programming languages?
« Reply #289 on: November 26, 2019, 08:02:55 pm »
There are also cases where splitting a statement over several lines can be useful. How do you do this without an end-of-statement token (such as ';')?

A tiny bit of imagination, or five seconds with google would answer this :-)

Various languages allow you to put a mark on a line indicating that it is a continuation of the previous line. FORTRAN's "C" in column 1 for example.

Various languages allow you to put a mark at the end of a line indicating that the next line is a continuation of this one. "\" in C and .. oh yes .. Python, for example. Notionally "escaping" the following newline character.

Various languages that don't require statement separators will try to continue parsing of a statement onto the next line if finishing at the end of the current line would be a syntax error, for example because the line ends with an operator such as + or *,  or because some bracketing structure hasn't been closed. Python, for example. Or C's ancestor BCPL.


I *strongly* dislike Python's use of whitespace as significant to the semantics, but it's silly to pretend there's no possibility to break a statement up over multiple lines if you don't use a semicolon to terminate them.
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4957
  • Country: si
Re: Too many programming languages?
« Reply #290 on: November 26, 2019, 08:04:38 pm »
While i do find the way indentation works as part of the syntax in Python a bit questionable, it still works just fine as long as you tell your code editor to only use tab or only space. At least it forces sloppy programmers to properly indent there stuff i suppose.

Python still has a ; for the case where you DO want to terminate a line early, but doesn't require one where its obvious you finished your line.
Code: [Select]
# Here is some code
y = 3
x = 5
print(x+y)

# This is functionally the same
y = 3; x = 5; print(x+y)

# This is also the same
y\
=\
3
x = 5; print(x+y)

# This is a more sensible use of it on a not so sensible function
x = really_long_named_function_with_plenty_of_arguments( \
      1,2,3,4 \
      ,really_long_varriable_name - 10 \
      ,really_long_varriable_name + 110 )
print(x)

Same thing, different syntax. If you compare how many lines of C code are a single statement with a ; on the end versus how many lines are split over multiple id say it makes more sense to have a character to continue on another line than having a character to terminate a line. Just like it makes more sense for the clutch in your car to be engaged when the pedal is released since that's the state it spends most of its time in.

Its also annoying when a compiler gets confused about a missing ; and spits out a nonsense error. Tho C compilers tend to be fairly robust and error out on the next line, of even going straight out telling you "Hey dumbass did you forget a semicolon there?". But i seen Verilog or VHDL compilers get so confused that they start throwing nonsense errors in code 300 lines before or after the missing semicolon, resulting in a good bit of cursing and shouting at the compiler until you figure out what actually made it so upset about compiling this file.
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Too many programming languages?
« Reply #291 on: November 26, 2019, 08:15:49 pm »
OTOH you've got to put those ugly backslashes there where C would not have needed them
    And this is a very old and boring discussion
       like tabs vs spaces.

You can continue; I quit;  :)
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4957
  • Country: si
Re: Too many programming languages?
« Reply #292 on: November 26, 2019, 08:25:11 pm »
Im not trying claim one or the other being superior.

Its just two different ways of doing things. Both work, both have there pros and cons. As long as the syntax rules don't force you into writing code in some ugly unreadable way then its fine.

My personal preference is for not having ; be required on ends of lines, but i don't mind them that much. If the language wants them il put them there. There are plenty of other things in languages that annoy me more than this minor thing.
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 19517
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Too many programming languages?
« Reply #293 on: November 26, 2019, 08:41:18 pm »
It strikes me some of the contributors to this thread need to understand the concept of "syntactic sugar", and why those experienced in more than one language regard it as uninteresting.

For myself, I only care about whether syntax makes it easier or more difficult to make mistakes. The semantics of a language are far more interesting and important.
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: nz
Re: Too many programming languages?
« Reply #294 on: November 26, 2019, 09:23:45 pm »
It strikes me some of the contributors to this thread need to understand the concept of "syntactic sugar", and why those experienced in more than one language regard it as uninteresting.

I agree. I can program in C, Python, Lisp, Forth/Postscript, various assembly languages, shell, perl .. I don't even know what else.

Quote
For myself, I only care about whether syntax makes it easier or more difficult to make mistakes. The semantics of a language are far more interesting and important.

It's always easy to make mistakes.

I care about how hard it is to find 'em.

Python make it far too easy to make editing mistakes with the delete key or accidentally mixing spaces and tabs in a way that *looks* the same give you a program that has no syntactic errors but silently does the wrong thing. Copying&pasting code via emails or web forums can also be problematic. With C code you can run a "pretty print" program (or command in your editor) to fix the formatting. That concept doesn't and can't apply to Python.
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: Too many programming languages?
« Reply #295 on: November 26, 2019, 10:03:29 pm »
There are also cases where splitting a statement over several lines can be useful. How do you do this without an end-of-statement token (such as ';')?

Well obviously you punch column 6 to mark it as a continuation card.  >:D
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: Too many programming languages?
« Reply #296 on: November 26, 2019, 10:05:24 pm »
Various languages allow you to put a mark on a line indicating that it is a continuation of the previous line. FORTRAN's "C" in column 1 for example.

Nope, that's a comment card.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: Too many programming languages?
« Reply #297 on: November 26, 2019, 10:29:01 pm »
Python make it far too easy to make editing mistakes with the delete key or accidentally mixing spaces and tabs in a way that *looks* the same give you a program that has no syntactic errors but silently does the wrong thing.
I enforce a no-tab-indentation in source code rule.

In Gedit/Pluma, highlighting all \t (with backslash escape sequences enabled in the search) is very useful in highlighting suspicious tabs. 'expand -t 8 source.py > fixed-source.py' is also quite useful.

Just for fun, I ran
Code: [Select]
reset ; find /usr -name '*.py' -print0 | xargs -r0n 1 awk '/^  *\t[\t ]*[^\t #]/||/^\t\t* [\t ]*[^\t #]/ { mixed++; next } /^\t\t*[^\t #]/ { tabs++; next } /^  *[^\t #]/ { spaces++; } END { if (mixed>0 || (spaces>0 && tabs>0)) printf "%4d %4d %4d %s\n", mixed, tabs, spaces, FILENAME }'to see which Python files under /usr (installed modules etc.) mix spaces and tabs in indentation, ignoring empty and comment lines.  (The output lists the number of lines with mixed space/tab indentation, the number of lines indented with tabs, and the number of lines intended with spaces, ignoring comment and whitespace lines, followed by the file name, skipping files with just space OR tab indentation.)
A lot of offenders...

I consider mixing spaces and tabs in Python indentation one of the many footguns available in various programming languages.
 
The following users thanked this post: legacy

Offline tycz

  • Regular Contributor
  • *
  • Posts: 99
Re: Too many programming languages?
« Reply #298 on: November 26, 2019, 10:38:56 pm »
There are also cases where splitting a statement over several lines can be useful. How do you do this without an end-of-statement token (such as ';')?

Pure Basic does multi line statements in an interesting way, without either the end of statement or line continuation tokens. It simply assumes you want to do continue the statement on the next line if you end the line with an operator or function parameter.

For example, these three statements are all equivalent.
Code: [Select]
If CheckValves(Arg1, Arg2, Arg3) And DetectLight(Arg1, Arg2, Arg3) And AnotherFunction(Arg1, Arg2, Arg3)
  ;code here
EndIf

If CheckValves(Arg1, Arg2, Arg3) And
  DetectLight(Arg1, Arg2, Arg3) And
  AnotherFunction(Arg1, Arg2, Arg3)
  ;code here
EndIf

If CheckValves(Arg1,
               Arg2,
               Arg3) And
  DetectLight(Arg1,
              Arg2,
              Arg3) And
  AnotherFunction(Arg1,
                  Arg2,
                  Arg3)
  ;code here
EndIf

 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4039
  • Country: nz
Re: Too many programming languages?
« Reply #299 on: November 27, 2019, 12:04:04 am »
Various languages allow you to put a mark on a line indicating that it is a continuation of the previous line. FORTRAN's "C" in column 1 for example.

Nope, that's a comment card.

Oh yes, quite correct. The continuation mark was anything in column 6, between the label and the code. It's (thankfully) been almost 40 years since I did fortran.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf