Review needed for the wiki - Pascal to D page

Baz via Digitalmars-d digitalmars-d at puremagic.com
Thu Dec 4 20:56:38 PST 2014


On Thursday, 4 December 2014 at 23:27:05 UTC, bearophile wrote:
> 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

Thx, to ketmar too. handled your commments.
And that's true that array and slice top index deserve a section, 
a good oportunity too to introduce opDollar. I was already 
thinking to add one because the "foreach(i; 0 .. 8)" expression 
is closed to the Pascal "for ... to ..." loop syntax, with the 
top index ambiguity in more.


More information about the Digitalmars-d mailing list