|
Bravo!!!
Steve Naidamast
Sr. Software Engineer
Black Falcon Software, Inc.
blackfalconsoftware@outlook.com
|
|
|
|
|
|
Member 14564709 wrote: Unfortunately BASIC has been all but killed off because it scared the crap out of the C guys.
i like your thinking. Plz check out my git.
https://github.com/contextual-project/contextual.js/wiki
|
|
|
|
|
Hello,
The question must be looked at from several perspectives.
I would start by saying that if you give me 3 sliders to grade "practical", "concise" and "human readable", there is no way you will reach 100% on each, I would argue that not even an 80-80-80 is possible.
Everything is a trade-off, and you will sacrifice in one area because there are things you definitely want to keep in another, and those things have a cost. It is up to you to decide which area you want to favor. Or rather, which language you want to support based on your style as a programmer.
Then comes the question of the language's purpose. One should not compare a system language vs a scripting language for example. By nature, they have different purposes, have been build to solve different issues. One is compiled, the other is interpreted, and like it or not this has an impact on its design.
Each area you suggest deserve its own debate, almost.
"Human readable" for example. In your example, I would not want a very long hash table to be described without any special character. In the real world, large XML or JSON files are a reality. Imagine those without anything to identify what goes where. Tab separated ? or indentation dependent ? I personally think Python is an abomination for that reason alone, but there I am going against the majority, so let's avoid waking up the beast
But you see, right here, by giving more focus to "human readable", you have already lost in practicality. Trade-off as I said.
"Practical" : you mentioned "it has community, tools, …" => well those things are not the language itself, and they do not make it practical. The language itself should be self sufficient, you want to compare apples with apples. The fact that a language has a huge community is just showing its popularity, not its intrinsic worth.
If I look at my own experience in scripting languages, I have done many, and I firmly believe that the best of them is Lua, but the world favors Python. So which is more practical ? Probably Python if you look at the community and tools, but I think it is Lua for the human-readable part.
As for conciseness, I think it is not really the biggest problem. At some point, you have to tell the computer what to do. The real question is how much you want to work to get there. The real question is : "how much work should be accomplished by the programmer and by the compiler ?"
If it is hard to write, it is probably easy to parse (think C++).
If it is easy to write, it is probably hard to parse (think any high-level language).
I am still dreaming of a language that is as powerful as C++ but as easy to write as Lua.
|
|
|
|
|
Fred2834 wrote: I would not want a very long hash table to be described without any special character. In the real world, large XML or JSON files are a reality. I would. If i had to enter/edit the data manually, then i would want a long hash table to be described without any special character.
I had to achieve exactly that with a new Javascript tool i created. I had to figure out a way to store human-editable data in html -- ie, plain text. So, no formatting, no tabular display.
Here's my solution. It uses no special characters at all, no tags, and unlike XML/JSON the fieldnames aren't repeated for every record. I find this quite readable. It's optimized for low-risk editing. There are no syntax to screw up or special symbols to put in the wrong place, no punctuation to get wrong. And it's far less laborious without having to type all those tags or braces.
<mt-records hidden id="tattooists">
NAME
LINK
DESCRIPTION
Genevieve Dupre
https:
This isn't what you expected.
Joey Armstrong
https://thunderhandtattoo.com
The most amazing.
</mt-records>
GitHub - johnaweiss/HTML-Micro-Templating: Lightweight, robust HTML templating system.[^]
Granted, this would quickly become unwieldy with a lot of fields. The solution above isn't intended for data with a ton of fields.
But if i had a lot of fields, then i wouldn't be manually editing raw data in plain text format. Dude, why are you doing that?
XML/JSON are best suited for machine manipulation, not human reading/editing. But this thread is about human readable languages, not machine languages. So i'm unclear how your XML/JSON contradicts my desire for human-readable code.
https://github.com/johnaweiss?tab=repositories
modified 9-Dec-22 14:12pm.
|
|
|
|
|
The major problem with your idea is "Human understandable"
you didn't define the audience, and saying "everybody" is not the answer.
my old mother trying to use a DVD player - one with not that many buttons:
"how do I make it go"
"press the 'Play' button."
"you mean this one '|> Play', with a triangle on it."
"yes."
"what does the triangle mean?" and that's not even adding in complications of her first language being English.
Let's look at your concise [anti] example
ADD YEARS TO AGE.
MULTIPLY PRICE BY QUANTITY GIVING COST.
SUBTRACT DISCOUNT FROM COST GIVING FINAL-COST. ahh the layman says, I see.
but then the accountant
it's all wrong, you've mixed up terms, "'cost' is purchasing, 'price' is selling." "price times quantity is selling price, not even 'nett cost' let alone 'cost'"
understandable to some, an abject failure to others, even the programmer and his audience spoke a different language - probably should fire the project manager for that stuffup.
Consider the image they placed on the Voyager space probe: the guy/gal in a circle with arms and legs stretched out in a circle - supposedly according to experts 'understandable' by anything that finds it. There's people on Earth, the very concept it's meant to represent that look at that and scratch their heads.
Early explorers would encounter 'natives [perhaps chanting] and shaking their spears'
- in some cases it meant 'go away, this is our [special] place, any closer we will attack'
- in others 'welcome strangers [yes we have weapons but we are choosing not to use them so be nice]'
Sorry, but "Human Understandable" is not possible, not without defining/limiting the audience and even the language.' Does say a Lithuanian farm hand that's never gone outside know what 'city' means? Even pictures don't help, how long were Egyptian hieroglyphs - pretty plain to the people of the time of writing - undecipherable before the Rosetta stone was found?
short answer is: it's impossible
pestilence [ pes-tl-uh ns ] noun
1. a deadly or virulent epidemic disease. especially bubonic plague.
2. something that is considered harmful, destructive, or evil.
Synonyms: pest, plague, CCP
|
|
|
|
|
Quote: The major problem with your idea is "Human understandable"
you didn't define the audience
But i did define it:
Quote: By "human-understandable", i DON'T mean "natural language" or "sounds like spoken English". I mean, provided you have learned the special programming syntax, and that learning that syntax is no more challenging or time-consuming than learning, say, Python.
The audience is people who have learned the special programming syntax.
|
|
|
|
|
It won't be the most concise, human-understandable and practical language but Dart sure is very concise, for a statically typed language, dropping a lot of the oop cruft that languages such as c# or java have
abstract class Item {
use();
}
class Chest<T> implements Item {
List<T> contents;
Chest(this.contents);
use() => print("$this has ${contents.length} items.");
}
class Sword implements Item {
int damage = 5;
use() => print("$this dealt $damage damage.");
}
main(){
var chest = Chest([Sword()]);
chest.use();
for (var item in chest.contents) {
item.use();
}
}
It drops public and private in favor of using "_" before private instance variables, doesn't require the new keyword, has a very concise (and imo clear) function definition style and a constructor definition that can't be made slimmer without impacting heavily on understandability.
Regarding
| Notice the lack of punctuation. Notice judicious use of whitespace as syntax.
(how do you quote text? )
Yeah, no, as you can see there is a lot of punctuation and whitespace is basically meaningless
For the practicality of this language... outside of Flutter, not much, honestly.
I find it to be very neat but it isn't going to replace js any time soon
Edit: the code is taken more or less literally from the examples on dart.dev
modified 18-May-20 3:09am.
|
|
|
|
|
Lorenzo Bertolino wrote: (how do you quote text? )
Select the text in the original message and click the "Quote Selected Text" button.
Or paste the text into the "message" box and select "Quoted Text" in the pop-up.
Or, if you want to do it the hard way, type the blockquote markup around the quoted text:
<blockquote class="quote"><div class="op">Quote:</div> Quoted text goes here...</blockquote> Quote: Quoted text goes here...
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Just pick C#, whatever your intentions.
5 years of working with high school graduates, and that's the one with the lowest learning curve on average.
At a glance, here are definitely more concise and human readable languages out there (lolcode is a nice example) but they all come at the cost of a much higher learning curve and very limited functionality.
Notice the lack of "or" in the previous sentence. 🙂
|
|
|
|
|
I was doing Windows programming in C++ for several years before switching to C#, learning many of its small advantages over C++ as I went along.
After a number of years with C#, I was going to pick up an old private hobby project in C++, and learned one huge advantage of C# over C++ that I had never realized before: The amount of red tape in C++! You spend an unbelievable amount of code lines on setting up and and initializing things, header files, declarations of all sorts. Module interfaces are handled by VS in a "database" (I grew up with ACID, so I put the term in quotes ) rather than header files. Sure, if you go behind the curtain, you will see that VS and WPF do very similar things, but they do it for you!
A number of small things are done for you as well, such as heap management. I started using VS when switching to C#; my old C++ project was sprinkled with lint directives (i.e. lint comments) all over, cluttering up the source files. With VS and C# I never missed Lint, there was no need for it. So I could drop lint from my C++ code as well, couldn't I? But VS Intellisense doesn't work half as well with C++ as with C#, much due to the far less controlled use of pointers in C++.
So rather than fixing up and completing my old C++ code, I deleted several hundreds of lines, a good bunch of header files, brushed out the heap management code and adapted the remaining code to C# standards. I never looked back.
With C++, so much of my attention, and so many source lines, are wasted on things that are not solving the real problem; it is just red tape to facilitate the problem solution part. For C#, this is far less prominent.
Certainly, C# has inherited from C/C++ a number of elements I wish it had not. (An example: Why do we have to announce in advance with a "try" that the block has an exception handler? The handler is there, that should be enough!) Some of it may be ascribed to the old single-pass parsing ideals, but today there is no reason to accept such limitation. I can live with it, but it is ugly. But if I have the choice, I will not live with all that other required C++ blurb that really does nothing towards solving the problem at hand.
|
|
|
|
|
Member 7989122 wrote: Why do we have to announce in advance with a "try" that the block has an exception handler? The handler is there, that should be enough!
CallSomeMethod();
try
{
CallSomeOtherMethod();
}
catch (SomeFunkyException)
{
} Without the explicit try , how would you indicate that the first method call wasn't covered by the catch block?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You could e.g. look at CHILL, aka Z.200: Any block may have a handler attached: If there is an ON-clause between the body of the block and the terminating semicolon, the block has a hanlder. If there is no ON-clause, it does not have a handler. THere is no need to pre-announce it.
Note that in CHILL, as well as in most other sensible languages of the Algol class, a statement is a block; you don't need to enclose a single statement to make it one. So it would be like
CallSomeMethod();
CallSomeOtherMethod() -- note: no semicolon - block not yet complete
ON (SomeFunkyException):
LogThisException();
END; -- here is the semicolon terminating the block Usually when you want to attch a handler to a group of statements, that group is e.g. a function body, a loop, an if/then/else etc. defining a block. If these two calls are looped, and you want to attach the handler to the loop - i.e. the it is invoked when the exception breaks out of this loop, you would write it as
DO
CallSomeMethod();
CallSomeOtherMethod();
OD -- note: no semicolon; loop still incomplete
ON (SomeFunkyException): -- handler for exception in the loop statement
LogThisException();
END; The DO-OD bracing of the loop body makes it a block, to which a handler may be attached without any further blocking.
If you want to attach a handler to the two calls, not to the loop as such, you have to make them into block by bracing them:
DO WHILE ExceptionCount < 10;
SomeCallNotHanldedByTheOnClause();
BEGIN
CallSomeMethod();
CallSomeOtherMethod();
END -- no semicolon - handler follows
ON (SomeFunkyException): -- handler for exception in the loop statement
LogThisException();
Exceptioncount +:= 1;
END;
AnotherCallWithNoHandler();
OD; Now the handler for the two statements is processed within the loop, and unless another exception is caused, control stays within the loop.
CHILL uses keywords rather than braces; that is not the point here. Braces might have saved a few keystrokes, but since keywords often come in pairs, they do their own bracketing, like DO-OD, ON-END, ... You need to indicate which kind of block (like DO), and adding a brace to indicate "I am serious - a block!" is redundant. You could of course save a keystroke by replacing the OD with a closing brace, but I'd find it strange for braces not to come in pairs. I rather have an OD terminating a loop body, a FI terminating an IF statement and so on, documenting the type of block terminated, rather than a series of anonymous braces terminating a nest of blocks.
You could also note that the use of distinct keywords avoids a lot of other blurb, e.g.
BEGIN
CallSomeMethod();
CallSomeOtherMethod();
END
ON (SomeFunkyException): LogFunkyException(); Funkiness +:= 1;
(SomeStrangeException): LogStrangeException(); Strangeness +:= 1;
ELSE: LogOtherException(); EXIT SurroundingStatementLabel;
END; Each ON-alternative defines a block, with no further need to bracket multiple statements.
CHILL is a language that was actually designed - it didn't end up that way by random luck because the space invasion game presented a new wish that K or R sat down the same night to put into the compiler as best they could. It was known before the first implmentation begun that no bracing was required to add exception handling to a block. That no bracing was required for each on-alternative. And so on. Consequences of the overall language design was considered before the spec was frosen.
So it was someting like that detestable "waterfall model", we'll have to admit that. That is a good enough reason for rejecting the language design, and rather go for one wit a lot of syntatical workadounds, braces, paretheses, keywords to pre-anounce what comes later and whathaveyou.
But please do not confuse "ability to create ugly workarounds that make the language survive" with good design!
|
|
|
|
|
I must be missing something - with the exception (no pun intended!) of the single-statement / single-block case, why is:
BEGIN
...
END
ON (SomeFunkyException): ...
END; any better than:
try
{
...
}
catch (SomeFunkyException)
{
...
} Is it just the curly-braces you don't like?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, you are missing something.
The BEGIN-END really has nothing to do with the exception handling - it does NOT announce the ON. It just creates a block out of smaller ones. It has multiple uses; you could e.g. label the block, and skip out of it if some test is not satisfied, like
ManySteps:
BEGIN
Step1();
IF PreparationWentWrong THEN EXIT ManySteps;
Step2();
IF Specialcondition THEN EXIT ManySteps;
Step3();
END ManySteps; This is just a way to make a block that is not a loop, not a conditional statement, not a function body, but just a sequence of smaller blocks put togeteher for some purpose (such as here: For leaving, when conditions are right). Actually, I sometimes do something similar in C#, using a "do { ... } while (false);" to allow me many exits from the statement sequence without cdreating a deep nest of if-statements - but the C family allows just exiting the innermost block; in CHILL you can exit directly from any labeled surrounding block.
Whatever might be: The BEGIN-END has nothing to do with the try {...}. You may say that in CHILL, any block "implies a try {}".
I do not like redundant markup, whether extra keywords, braces, parentheses or whatever. If you say "Here come a DO-block" by using a DO keyword, then you should not need to add neither BEGIN nor a brace to say that "this is the block". Of course it is - you said so already! When you say "Here comes a conditional block" by using an IF keyword, you should not need to use an open parenthesis to say that "here comes the condition". Of course - how often do you see an if keyword not followed by a condition? So why do you have to announce it by opening a parentheses pair? In prose text, you never need to write the condition part of a question in parentheses, why do you have to in C?
If you want to treat two smaller blocks as one unit, whether for exception handling, exiting or whatever, one way or another you must identify which blocks you are talking about. THat markup is not redundant, whether it is done with keywords, braces or indentation alone. When you are comparing the try{} with the BEGIN-END, you are comparing apples with oranges, redundant with non-redundant markup. In C-style languages, the braces are there for the try (alone):
try {
SingleStatement();
}
catch ... Well, you could argue that in C languages, the parentheses are not redundant, as a single statement is not considered a block, so the braces are required to created on. That is a major flaw in the language "design". Conceptually, there it adds no information; the braces are conceptually redundant even though the syntax rules explain why they have to be there. In CHILL, there is no such need, neither for bracketing constructs nor for the try keyword.
Braces are fine for their brevity. But they are anonymous; they carry no distinguishing information neither to the compiler nor to the reader. At the end of a deep nest, in C languages there may be a lisp-like sequence of closing parentheses, and you may have a hard time seeing which one closes the outermost loop, the while, the function, the class... With a DO-OD, first, you need no redundant start-of-block brace, second, you know when you see the OD that this is not the end of the function or module or an if, but of the loop. If it is unclear which loop, you may label the statement and include the label after the OD, like I did with the END ManySteps; - this is optional, but if you use it, it is checked by the compiler.
Using OD rather than a closing brace also tells the compiler about your intention: It will match it up with the DO, and can therefore provide much better error reporting and error recovery so that it can go on with the parsing. If the compiler just sees a sequence of closing braces, it cannot tell which one is intended to match which opening brace. So, was the follwing statement intended to be part of the ELSE block? or the loop body? or...?
In my previous post I also illustrated how the explicitness of keywords makes extra bracketing of e.g. on-alternatives unneccessary; the keyword alone gives sufficient information.
For the BEGIN-END pair in particular, you might argue that no more information is added than with braces, so in that case you could use braces. But a mixture of some blocks being denoted by keywords, other by special symbols, looks rather messy. And, you do not that often need to combine an arbitrary sequence of smaller blocks (/statements) into a larger block: When you EXIT something, it is usually a loop, a function or something that is already a block and doesn't need any extra embracing. Same with exception handlers: You very often set them up for a function, a loop, a condition, or a single statement. For the quite few cases where you block up two or three statements for some purposes, you can affort that little handful of extra keystrokes. Especially considering the advantages to readability and improved compiler support.
|
|
|
|
|
Member 7989122 wrote: This is just a way to make a block that is not a loop, not a conditional statement, not a function body, but just a sequence of smaller blocks put togeteher for some purpose
You can create a similar block in C# using braces. And if you're particularly masochistic, you can mimic the EXIT with a goto[^].
ManySteps:
BEGIN
Step1();
IF PreparationWentWrong THEN EXIT ManySteps;
Step2();
IF Specialcondition THEN EXIT ManySteps;
Step3();
END ManySteps;
{
Step1();
if (PreparationWentWrong) goto ExitManySteps;
Step2();
if (Specialcondition) goto ExitManySteps;
Step3();
}
ExitManySteps: But this example would probably be better handled with SEH - if something went wrong, you don't want to depend on the caller checking a return value, or some unrelated property.
Member 7989122 wrote: When you say "Here comes a conditional block" by using an IF keyword, you should not need to use an open parenthesis to say that "here comes the condition".
That could potentially lead to ambiguity - which statement(s) are part of the condition, and which are part of the branch? Even if it's always obvious to the compiler, it may not always be obvious to the person reading the code. And the main point of any code is to be read and understood by a person.
Member 7989122 wrote: That is a major flaw in the language "design".
No, it's a major difference in the language design. (And yes, the language was designed. No need for the sarcisti-quotes.)
English doesn't have accents on any letters; you're just supposed to know how to pronounce them. Does that makes the accents in other languages a flaw? Or is English the flawed language for not having them?
Just because something is different doesn't mean that it's flawed.
Member 7989122 wrote: At the end of a deep nest, in C languages there may be a lisp-like sequence of closing parentheses, and you may have a hard time seeing which one closes the outermost loop, the while, the function, the class...
Agreed. But code that's nested that deeply is crying out to be refactored anyway.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: And yes, the language was designed. I'd certainly like to see those design documents. Which alternatives were considered, the rationale behind each, the arguments for the selected solution. I have never ever heard even the tiniest little suggestion that any such thing exists.
What was the rationale for not having a proper argument list in the function header, in the initial K&R, but listing the arguments below the header?
What was the arguments when the language was redesigned for changing it to how other Algol-class languages did it?
What was the rationale for not defining a statement to be a block, as in most other Algol-class languages?
What was the rationale for defining the syntax of conditional statements like while-loops and if-statements so that parentheses are required around the condition - it is not in languages like Pascal, CHILL, Algol?
What was the rationale for using the equals sign for assignment, so that an equals condition must be represented by two equals signs?
What was the rational for deviating from the ISO standard interpretation of the CR, LF and NUL character codes?
What was the rationale for not including enumeration types, as a first class type, in the language? For Algol-60, you can find discussions of it in the design douments, but lack of resources prevented them from implementing it time for the deadline, so it was omitted from the specificatin - but Pascal implemented it a few years later. Why didn't C?
This thread has said a lot about exception handling. The first generation of C/C++ execption handling was not part of the language definition, but a cludge realized by macros and longjmp so that programmers could pretend that C had the same facilites as (some) other languages. Was there a design document for this? Was there a design document specifying how to incorporate this cludge in the language itself?
Writing a book a couple of years after the implementation, to tell: See what we have implemented! - that is not a language design process.
Algol was through a design process. CHILL was through a design process, where several competing proposals were analyzed, and after critical evaluation of each feature, a choice was made to how it ws to be defined in the final specification. Starting with Fortran 77, Fortran has been further developed in a similar way, but of course with strong dependencies on earlier language versions.
SUN tried to make ISO accept Java as an ISO standard. But when they learned that they could not simply revise the standard themselves and slam the document on ISO's desk: Here is the new version!, but learned that there would be a committee to eavaluate the new features critically from various angels, designing a new version, then SUN retracted their application for ISO approval. They may have had similar internal evaluation and design rounds, but they were not willing to let others in, as ISO procedures demanded.
Nowadays, C/C++ revisions are into such a mill of critial evaluation, rational decisions and lots of people having their voice heard. Like Fortran, the legacy is heavy.
If you can give any pointers to sources documenting that legacy C, preceeding the ANSI approval was the subject of design, rationale and critical evaluation of alternatives, then I would certainly like to see it. I am not thinking of "I remember how it was back then...", but actual design documents, created at a time when the design was made, not as a history book looking back.
|
|
|
|
|
Going back to Kate's message that started this branch[^], we were talking about C#.
Since 2013, all C# design discussions have been public on GitHub:
GitHub - dotnet/csharplang: The official repo for the design of the C# programming language[^]
Earlier discussions were not made public, but some information was available on various MSDN blogs.
The language was originally designed by a team lead by Anders Hejlsberg.
As for C/C++, the details of those decisions are likely lost in the murky depths of the dim and distant past of 1972, unless Dennis Ritchie kept some notes somewhere.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Javascript is obviously dynamically typed - but as I gravitate towards statically typed languages, I'll go for a language like Ocaml, Haskell or F#. They all define record types similarly, but with slightly different keywords and syntax.
I'll give an example in Haskell:
data Location = Location { city :: String }
let home = Location { city = "Boston" }
and F#
type Location = { City : string }
let home = Location { City = "Boston" }
let other_home = {| City = "Boston" |}
johnywhy wrote: I mean, easy to understand at a glance.
I find Haskell's syntax pretty clear for pure functions. Having pattern matching brought out to the top level of function definitions makes it similar to have you might write a piece-wise definition of said function. Having function signatures be optional (the compiler will work out what the signature should be if you leave it out) leaves code less cluttered
factorial 1 = 1
factorial n = n * factorial (n-1)
list_length [] = 0
list_length (first_element:rest) = 1 + list_length rest
and F# again:
let rec fac n =
match n with
| 1 -> 1
| n -> n * fac (n-1)
let rec length list =
match list with
| [] -> 0
| first :: rest -> 1 + length rest
johnywhy wrote: What's "Concise"?
johnywhy wrote: What's "Practical"
I'll probably select F#. It's a .NET language, so can use .NET libraries. I like how the various features work together to provide powerful facilities with little code. An example - some code taken from the Microsoft website to download a bunch of URLs in parallel, with async/await
open System.Net
open Microsoft.FSharp.Control.WebExtensions
let urlList = [ "Microsoft.com", "http://www.microsoft.com/"
"MSDN", "http://msdn.microsoft.com/"
"Bing", "http://www.bing.com"
]
let fetchAsync(name, url:string) =
async {
try
let uri = new System.Uri(url)
let webClient = new WebClient()
let! html = webClient.AsyncDownloadString(uri)
printfn "Read %d characters for %s" html.Length name
with
| ex -> printfn "%s" (ex.Message);
}
let runAll() =
urlList
|> Seq.map fetchAsync
|> Async.Parallel
|> Async.RunSynchronously
|> ignore
runAll()
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Every professional program has 3 audiences:
1. the programmer
2. other programmers
3. the compiler
The "fantasy language" fails in all 3 areas:
1. Sure, right now the syntax makes perfect sense. But come back to the same code after a 6 month or even 2 year lapse? Every programmer (including me) I know looks at their own, older code with a "WTF was I doing?" expression on their face. Remove the keywords and punctuation and the problem gets a lot harder. Everyone thinks they'll remember exactly what they were doing at the time; 99%+ of us don't.
2. A professional program is highly likely to be supported (eventually) by at least one other programmer. The problems of point #1 are multiplied by 10 or even 100 because the second programmer has to figure things out. I've supported enough code to have a deep appreciation for well organized code that includes comments which explain "why" something is being done. My effort is reduced tremendously by those 2 things.
3. Use of "judicious" whitespace as syntax is a poor idea. Sure, the compiler can figure it out, but when the whitespace is wrong, the programmer cannot see the mistake. The real problem here is not compiler errors (which should point out the offending line so the programmer can [hopefully] figure it out), but when the program DOES compile and run, but produces wrong results.
The constant move towards conciseness is being taken to an extreme, and it's causing more problems than it is solving. The more concise the language, the steeper the learning curve, and the more prone to programmer errors, and those problems are harder to solve.
Programming languages are created for people, not computers. The computer runs machine code -- regardless of how the program starts, it ends up in machine code. Write your code so the someone else can figure things out in the least amount of time.
|
|
|
|
|
Let me explain to you the undesirability of you desire:
All that punctuation is to remove ambiguity.
You can play games and replace semicolons with new-lines, specific indent counts, whatever, and it's still the same. Is "Start->End" really better than "{->}". Neither logically nor visually.
If you have a block of code in a conditional you need some method to mark statements off as part of the block and not just the next statements to be executed after the conditional.
As for why things keep copying the 'C-like' structure? Not saying it's the end-all of design but it eliminates a lot of the absurd arbitrary. Like my first language, FORTRAN, having all statements start in column seven.
I find your javascript example ludicrous. You make the javaScript unnecessarily complex for the simple act of assigning a value to a symbol - but not in your dream version. Just to start.
Coming right down to it - human readable is a nebulous concept as you intend it. Mandarin is human readable - unless you don't know it. So is Hindi, Hebrew, and Arabic. Unless you are not accustomed to it. Those who speak these languages natively would differ with you strongly as to what is readable. Thus it is for a coding language. You learn to look at it and your eyes and brain will translate it. Meanwhile, the efficient interpretation of the syntax is guaranteed by the punctuation.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
Well, just in terms of the JavaScript, here is how I would write it.
var home =
{
cit : "Boston"
};
home.city = function(aCity)
{
if (arguments.length)
this.cit = aCity;
else
return this.cit;
};
Yes, the function is a bit longer but there is only one function instead of two and writing pointless "get" and "set" is no longer necessary. That is a holdover from languages which do not have true getter / setter type attributes. I would note that the function would normally be part of a class (or prototype) and not the object itself.
In C++, it takes more work, but you can write code so that you can literally write
aCity = home.city;
home.city = aCity;
I usually don't do that, but I do do the same thing in C++ as in JavaScript. Note that brace placement may make it look longer, but that is matter of style. Braces are part of a statement block, so I indent the same as the statement block. And don't use unnecessary braces. The make code less readable.
I agree with you about APL not being readable. Perl has a lot of the same characteristics.
I disagree about COBOL, it is both far less concise and far less readable.
If something is too concise, it becomes unreadable. But, conversely, when it is too expansive (non-concise?) then it is also less readable. A straight mathematical expression whether in a conditional or an assignment is generally maximally readable. Assuming that the length and complexity of the expression is not too large. And that weird and strange operators (APL) are not in use.
So languages whose basic structure is similar to C tend to be most readable without becoming too concise.
|
|
|
|
|
A couple questions:
What is your audience? Non-technical average Joe? Technical (domain expert) but non-programmer? Software engineer? Firmware Engineer?, etc, etc, etc.
What is the target program type? Web? Windows/Linux application? Embedded realtime?, etc, etc, etc
I believe you're not going to find (or create) the 'perfect' language that's practical and concise that will handle all these user types and targets.
|
|
|
|
|
Kotlin: maybe not best "human-understandable" but it takes Java and make it more concise.
You don't have to write many things the Kotlin that you write in the Java.
Red: it's still in the alpha version but you should keep an eye on it.
You can write in different styles but you can write small & concise code. It has some "weird features".
Ruby: It might be not fastest language but it's very readable. No "parenthesis hell" (same as in the Red) as in other languages.
|
|
|
|
|
No one has mentioned Python?!? That's interesting.
|
|
|
|
|