> Ultimately this: > FILE * test_file = fopen(“/tmp/test.txt”, “w+”); > Should become something like this: > create file /tmp/test.txt for input and output as test_file > Syntax highlighting should work instead of syntax notation just fine. I couldn't disagree more. The first example is easily scannable visually -- a variable is being created from a function call. I can tell because my eyes immediately notice the mid…
If I were to invent a programming language for the 21st century
131–140 of 184 posts
Re: If I were to invent a programming language for the 21st century
#132> Ultimately this: > FILE * test_file = fopen(“/tmp/test.txt”, “w+”); > Should become something like this: > create file /tmp/test.txt for input and output as test_file > Syntax highlighting should work instead of syntax notation just fine. I couldn't disagree more. The first example is easily scannable visually -- a variable is being created from a function call. I can tell because my eyes immediately notice the mid…
Very much agree. Programming notation, like math, is supposed to be easy to convey exact meaning, unlike human language. Every attempt there has been to make code look like English hasn't worked out well. SQL, for example, is incredibly verbose, with complex syntax. This obscures what is otherwise very good semantics. I think this is why a lot of people hate writing queries.
Now people who read lots of papers are probably used to this exercise but that doesn’t mean it’s a good thing (you can get used to running on one leg, but that doesn’t mean there aren’t better ways to run!). I am of the opinion that initials, or full words should be used in formula.
Re: If I were to invent a programming language for the 21st century
#133> Ultimately this: > FILE * test_file = fopen(“/tmp/test.txt”, “w+”); > Should become something like this: > create file /tmp/test.txt for input and output as test_file > Syntax highlighting should work instead of syntax notation just fine. I couldn't disagree more. The first example is easily scannable visually -- a variable is being created from a function call. I can tell because my eyes immediately notice the mid…
But are’t you describing familiarity rather than readability? Ask a non programmer if he thinks the syntax of c code feels logical and natural.
Re: If I were to invent a programming language for the 21st century
#134Earlier quoted context omitted.
But are’t you describing familiarity rather than readability? Ask a non programmer if he thinks the syntax of c code feels logical and natural.
Ask me if I think that the syntax of Chinese language feels..., well, like anything at all (punctuation marks are western influence).
Re: If I were to invent a programming language for the 21st century
#135Re: If I were to invent a programming language for the 21st century
#136Earlier quoted context omitted.
> If I were to invent a programming language for the 21st century, the main feature that would make people frown is that it would not be laid down in a flat text file. Yes! It drives me crazy that due to a historical accident, we're still essentially writing programs as decks of 80-column punch cards. Nowadays the decks are virtual and the editing tools are better, but languages really haven't evolved to take advanta…
I think that'd be useful for commenting but nothing else. Whenever I see something in code, I wonder, what does this do? If I started seeing bold and italics and it did nothing but draw attention, I would almost certainly feel it a distraction.
But isn’t that a good enough use case?
Almost nobody bothers to put proper formatting, diagrams, tables, formulas, references etc in their source code. At best we get ASCII approximations.
To see some examples of what it could be like look at Mathematica, Jupyter, literate programming, and org-babel.
Re: If I were to invent a programming language for the 21st century
#137> Ultimately this: > FILE * test_file = fopen(“/tmp/test.txt”, “w+”); > Should become something like this: > create file /tmp/test.txt for input and output as test_file > Syntax highlighting should work instead of syntax notation just fine. I couldn't disagree more. The first example is easily scannable visually -- a variable is being created from a function call. I can tell because my eyes immediately notice the mid…
with open("/tmp/test.txt", "w+") as test_file:
do_something_with(test_file)
And you get test_file closed for free at the end of the block.Re: If I were to invent a programming language for the 21st century
#138> Ultimately this: > FILE * test_file = fopen(“/tmp/test.txt”, “w+”); > Should become something like this: > create file /tmp/test.txt for input and output as test_file > Syntax highlighting should work instead of syntax notation just fine. I couldn't disagree more. The first example is easily scannable visually -- a variable is being created from a function call. I can tell because my eyes immediately notice the mid…
Very much agree. Programming notation, like math, is supposed to be easy to convey exact meaning, unlike human language. Every attempt there has been to make code look like English hasn't worked out well. SQL, for example, is incredibly verbose, with complex syntax. This obscures what is otherwise very good semantics. I think this is why a lot of people hate writing queries.
Not true. Ruby is incredibly readable
Re: If I were to invent a programming language for the 21st century
#139> Ultimately this: > FILE * test_file = fopen(“/tmp/test.txt”, “w+”); > Should become something like this: > create file /tmp/test.txt for input and output as test_file > Syntax highlighting should work instead of syntax notation just fine. I couldn't disagree more. The first example is easily scannable visually -- a variable is being created from a function call. I can tell because my eyes immediately notice the mid…
I think the goal in general should be to minimize conceptual depth and maximize predictability for the problem domain you are trying to address. I dislike the C style for several reasons: > FILE * test_file = fopen(“/tmp/test.txt”, “w+”); First, you have to understand the implications of it being a pointer, which includes the little warning light in your head about ownership and allocation/deallocation. Then you have…
Thats a semantic issue, not a syntax/style one. If your language has pointer semantics, you’d need to a way to access it with either proposed styles, and the same warning light should appear regardless.
The w+ example is much more relevant, as it could be expressed more clearly and well-defined (eg enum with full name). But all you could do with the pointer syntax is say FILE POINTER test_file, and gain nothing, because the “*” syntax isn’t at fault here
Re: If I were to invent a programming language for the 21st century
#140> Ultimately this: > FILE * test_file = fopen(“/tmp/test.txt”, “w+”); > Should become something like this: > create file /tmp/test.txt for input and output as test_file > Syntax highlighting should work instead of syntax notation just fine. I couldn't disagree more. The first example is easily scannable visually -- a variable is being created from a function call. I can tell because my eyes immediately notice the mid…
Indeed, there's a reason that SQL statements still need formatting and keyword capitalization hints to make it readable.
And the caps hint is the same as syntax highlighting... its not even that useful if you have highlighting, but boy is it useful when you don’t