dmt: Python-like indentation in D programming language

Witold Baryluk witold.baryluk at gmail.com
Wed Nov 17 17:23:14 UTC 2021


On Wednesday, 17 November 2021 at 08:28:07 UTC, mw wrote:
>
> To be frank, by just Python syntax alone I wasn't sure how many 
> people want to try it.

There are good reasons for it.

1) It enforces indentations, so code is harder to screw up. Also 
because you need to indent, it often is easier to spot too deep 
nesting, and fix it, instead of hiding it.

2) From my experience with porting few small programs (50-1000 
lines) to `dmt`, the resulting code is shorter than original D 
code, by about 15% on average. This is mostly due to closing `}` 
being removed:

3) It might be of interest to people who know Python, but do not 
know C, C++ or Java.

> I'm wondering if it can translate existing Python code (e.g 
> with a bit py3 type annotations) to D code, then it may attract 
> much more users.

No. And not planned. Sparkling some `auto` here and there 
manually, makes it quite possible tho. I did port on Python 
program to `dmt` rather quickly. But of course if you use 
standard library, things are harder.

Cheers.



More information about the Digitalmars-d-announce mailing list