Linked by Thom Holwerda on Tue 2nd Jan 2007 21:39 UTC
General Development "D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. Special attention is given to the needs of quality assurance, documentation, management, portability and reliability. D is statically typed, and compiles direct to native code. It's multiparadigm: supporting imperative, object oriented, and template metaprogramming styles. It's a member of the C syntax family, and its look and feel is very close to C++'s. See this comparison of D with C, C++, C#, and Java."
Thread beginning with comment 198177
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: Extendable syntax
by vinterbleg on Wed 3rd Jan 2007 07:34 UTC in reply to "RE[2]: Extendable syntax"
vinterbleg
Member since:
2005-07-11

Implementing that is impossible in a compiled language, and I believe in any language that is parsed using current-day language parsers.

Since what you have in mind (as I understand it) involves modifying the syntax of the language in new ways, you would need a whole meta-language for modifying the base language, which involves another parser. Generally, I cannot see how this is worth the trouble. Not only will the parser be immensely complex (and thus bug-prone), it will also produce confusing and unreadable source-code (since every programmer can basically make up his own language conventions).

What defines a language is not the things you express with it, but the things you don't express with it.

- Simon

Reply Parent Bookmark Score: 1

RE[4]: Extendable syntax
by John Nilsson on Wed 3rd Jan 2007 07:59 in reply to "RE[3]: Extendable syntax"
John Nilsson Member since:
2005-07-06

Why impossible? But OK, it doesn't have to be infinitely flexible.

For example, in SML you can define any function that takes two arguments as infix and what precedence level it should have. It doesn't seem to support postfix though.

Is this possible in C++/Ruby or can you only redefine a given set of infix operators?

There should be a continuum from fixed syntax - overridable syntax - modifiable sytnax - extendable syntax - redefinable syntax - flexible syntax. So how for out on the right can you go? How much has been done already?

Postfix and infix should be trivial. Trinary a bit harder, but not that much. Syntax that wraps a block ([]"" and such) even harder.

C has macros to achieve a little syntax extension, but they are quite limited. But a preprocessor may be one way. Compiler plug-ins could be another way. In any case you shouldn't have to write a whole compiler just to get one language feature.

Reply Parent Bookmark Score: 2