Reasons to use D

via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 12 11:59:09 PDT 2015


On Saturday, 12 September 2015 at 18:48:52 UTC, Adam D. Ruppe 
wrote:
> On Saturday, 12 September 2015 at 18:44:44 UTC, Ola Fosheim 
> Grøstad wrote:
>> Arrayviews ("slices") are available as a type so you can do it 
>> like this:
>
> Yeah, there's also the Array.slice and String.substring that 
> work kinda similarly in old standard javascript.

Array.slice create value copies, not reference views. I don't 
think there is a "slice" for Array. :-/

> But there's still a lot of type-specific verbiage in there, 
> whereas with D, it is always the same [a .. $] for almost 
> anything so it is one thing to remember instead of three or 
> more.

Yes. So, let's create a TypeScript like subset of:D.

Compile GC-based D-JS -> JavaScript + TypeScript definitions.

The problem is that you might need a little bit of Dependent 
Typing in order to provide types for the browser API. I.e. return 
type depending on parameter values? Not sure.




More information about the Digitalmars-d mailing list