I've been watching an interview with Herb Sutter on Channel9 and he mentioned at the end of the video that left to right language syntax would be on the top on his whishlist for a future C++ standard(although he acknowledges that modifying C++ in that way would pretty much make for a completely different beast).

Apart from:

more understandable by humans, clearer to the naked eye;e.g.

//C syntax
/*pointer to function taking a pointer to function(which takes 2 integers as
arguments and returns an int), and an int as arguments and returning an int*/
int (*fp)(int (*ff)(int x, int y), int b)
//Go analogous syntax which is left to write
f func(func(int,int) int, int) int

easier to parse(leads to better tool support as mentioned in the video - e.g. code refactoring)

what other advantages are there with a "left to right" syntax in a programming language.
I know only of Pascal and Go employing that kind of syntax(and Go does not even go the full way as I understand from this blog post from which I took also the examples)
Would it be feasible to have a systems programming language with that kind of syntax?

Using a similar approach to uniform initialization in C++0x (i.e. {} to identify initialization). Note that with a left to right approach it is much clearer what we are defining. Many people (me for sure) have been bitten at any point by this parsing error in the past (more than once), and that would not be the case with a left-to-right syntax.

How about expressions? How would this "left to right syntax" affect the operator precedence and order of evaluation?
–
celavekAug 18 '11 at 8:40

1

@celavek: If you go back to the interview, you will note that he does not want to change the whole syntax of the language, only declarations and definitions. Of course, that might permeate in other expressions, I am not too sure that the last line in the examples above is proper left-to-right (think on how the temporary is created, that might need to be changed... in C# that is solved by giving two semantics to the new operator for struct or class, which is not applicable to C++ as in C++ there is no distinctions on value/reference types.
–
David Rodríguez - dribeasAug 18 '11 at 8:56

How We Got Here

The C syntax for declaring function points was intended to mirror usage. Consider a regular function declaration like this from <math.h>:

double round(double number);

To have a point variable you can assign that to with type safety using

fp = round;

you’d need to have declared that fp point variable this way:

double (*fp)(double number);

So all you have to do is look at how you would use the function, and replace the name of that function with a pointer reference, making round into *fp. However, you need an extra set of parens, which some would say makes it a bit messier.

Arguably, this used to be easier in the original C, which didn’t even have function signature, but let’s not go back there, ok?

The place it becomes especially nasty is figuring out how to declare a function that either takes as an argument or returns a pointer to a function, or both.

If you had a function:

void myhandler(int signo);

you could pass it to the signal function(3) this way:

signal(SIGHUP, myhandler);

or if you want to keep the old handler, then

old_handler = signal(SIGHUP, new_handler);

which is pretty easy. What is pretty easy — nor pretty, nor easy — is getting the declarations right.

signal(int signo, ???)

Well, you just go back to your function declaration and swap the name for a point reference:

signal(int sendsig, void (*hisfunc)(int gotsig));

Because you are not declaring gotsig, you might find it easier to read if you omit:

signal(int sendsig, void (*hisfunc)(int));

Or maybe not. :(

Except that that is not good enough, because signal(3) also returns the old handler, as in:

old_handler = signal(SIGHUP, new_handler);

So now you have to figure out how to declare all those.

void (*old_handler)(int gotsig);

is enough for the variable you’re going to assign to. Note that you are not really declaring gotsig here, only old_handler. So this is really enough:

void (*old_handler)(int);

That brings us to a correct definition for signal(3):

void (*signal(int signo, void (*handler)(int)))(int);

Typedefs to the Rescue

By this time, I think everyone will agree that that’s a mess. Sometimes it’s better to name your abstractions; often, really. With the right typedef, this becomes much easier to understand:

typedef void (*sig_t) (int);

Now your own handler variable becomes

sig_t old_handler, new_handler;

and your declaration for signal(3) becomes just

sig_t signal(int signo, sig_t handler);

which is suddenly comprehensible. Getting rid of the *’s also gets rid of some of the confusing parentheses (and they say parens always make things easier to understand — hah!). Your usage is still the same:

old_handler = signal(SIGHUP, new_handler);

but now you have chance of understanding the declarations for old_handler, new_handler, and even signal when you first encounter them or need to write them.

Conclusion

Very few C programmers, it turns out, are capable of devising the correct declarations for these things on their own without consulting reference materials.

I know, because we once had this very question on our interview questions for people doing kernel and device driver work. :) Sure, we lost a lot of candidates that way as they crashed and burned on the whiteboard. But we also avoided hiring people who claimed they had previous experience in this area but couldn’t actually do the work.

Because of this widespread difficulty, though, it is probably not just sensible but indeed reasonable to have a way to go about all those declarations that no longer require you to be a triple-alpha geek programmer sitting three sigmas above the mean just to use this sort of thing comfortably.

I think you somewhat missed the point when you focused on the left-to-right bit.

The problem of C and C++ are the horrendous grammar they have, which is difficult to both read (humans) and parse (tools).

Having a more consistent (or regular) grammar makes it easier on both. And easier parsing mean easier tooling: most current tools do not get C++ right, not even the latest plugin of Eclipse as they sought to reinvent the wheel... and failed, and they probably have more people than the average OS project.

So you probably nailed it when focusing on reading and parsing... and that's a big deal :)

You completely missed the point. The question is not about natural languagae. Furthermore, your statement "With right oriented lang processing software must get all input before can parse it" does not make sense to me.
–
IngoAug 18 '11 at 9:45

Left-to-right looks and sounds more reasonable because that is HIS personal view. That can be proposed to SC then the C will review and check. I actually don't have any grudge against Sutter, I don't even know who that guy is, but if you or anyone visiting this stackoverflow often are wishing to know more ideas of who has better C++ development capability, then I would like to appoint Scott Meyer, who definitely has better knowledge of C++ than anyone else I have heard of and read about.
I have read his books not once but several times, and I think he has a very good C++ problem solving skill (an indepth experience over the language). He pay attention to his writing skills quite a lot, that is respectful of him towards his readers. His items are concise and are carefully checked before printing and publishing the books. Although his books are categorized as C++ indepth series, all items are well-explained from basic to the advanced level, which I confirm even an intermediate or those who just passed the first course in C++ can understand most the book.

I rarely downvote (and in this case it's pointless), but this deserves a -1. The majority of this answer has nothing to do with the question!
–
NimAug 18 '11 at 8:33

Thank, I am clear now. :). Seriously I find Scott have much better ideas than this guy. Idea of this syntax chaining is not new, but sounds stupid to implement. I don't think that can take anything darker out of the current complier tech.
–
Black and WhiteAug 18 '11 at 8:35

1

You don't even know who this guy is. You certainly didn't read any of his articles. How can you have an opinion who has better ideas? That's just ridiculous.
–
Karoly HorvathAug 18 '11 at 8:45

I'm not interested in opinions about certain persons ... I can judge that for myself. That video just triggered me wanting to know a little bit more about this subject, so that's why I provided a link to it. I don't advertise it, I don't propose it or endorse it but it's just there as a reference.
–
celavekAug 18 '11 at 8:49