Review needed for the wiki - Pascal to D page

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 4 15:27:04 PST 2014


Baz:

> "Attack" me on the content of:
>
>   http://wiki.dlang.org/Coming_From/Delphi
>
> This is my user experience about coming from Pascal/Delphi to D.

Thank you for the work :-)

Code Rosetta, etc. => Rosetta Code.


> D has a feature similar to Pascal/delphi source inclusion.

Yes, but in 99.9% cases in D you use the module system.


>D has no equivalent feature. The published attribute does not 
>exist but instead you have some compile-time reflection<

D has some run-time features, like typeid, and other stuff in 
object.d.


>    public bool opIn_r(char elem){
>        import std.algorithm;
>        return canFind(str,elem);
>    }

There are also ways to do that with an associative array, or with 
a bit set in amortized O(1) or strict O(1).


> In D, is is used to test the equivalence of two types, at 
> compile-time.

And also to compare bitwise two values, like two class references.


> The D2 way is to use a struct combined with an alias this 
> expression:

There is also the currently not good Phobos "Typedef".


Another note worth adding is that built-in D arrays start from 
index 0 and they have only size_t indexes.

There are probably several more things worth adding to that page, 
but it's a nice start.

Bye,
bearophile


More information about the Digitalmars-d mailing list