Python-like tabs instead of curley brackets?

Nils Hensel nils.hensel at web.de
Sun Oct 29 07:44:10 PST 2006


Chris Nicholson-Sauls schrieb:
> Charles Fox wrote:
> Doing this, we would sacrifice expressiveness,
How's that?

> source portability,
Why?

> useful niche  features such as anonymous scopes,
Not if you have a keyword for that.

> and enter the world of ambiguous nesting levels.
In what way are they ambiguous?

> Python and D are two different galaxies.
I'd say: "different tools, same shed".

> Python is not a systems language (technically, its interprative, and doesn't provide
> any low-level functionality that I recall).
Python is as interpretated as Java is (bytecode VM).
It is often refered to as a glue language because it will hold together
very different pieces of software. Even those written in C or even D.

> Scope-by-indentation is a good choice in that case, where the speed and 
> blindness of parsing are paramount.  It would be a massacre for D.
That is just not true. Scope indentation usually just results in an
openly visible code structure and shorter source code because of the
lack of unnecessary delimiter syntax.

I've written a preprocessor for C-style languages which allows me to
write in a Python like manner and still have C(++) or D sources for
compilation.

I wrote the first version in january 2005 and have been using it
eversince. It all works very well and allows me to write very readable
sources that are usually about 25-30% shorter than the output files.

The only shortcoming I've noticed was that with indentation based syntax
you are unable to write bottom controlled loops, at least not in a way
that it'll be recognized as such.


Regards,
Nils



More information about the Digitalmars-d mailing list