Rust Vs Dlang,I want more experienced

A better example would have been to mixin a new function that you then call as part of generating another mixin function. However, even the above requires type information: how else do you know what PREFIX is? I mean, at the point macros are run, you don't even have names. PREFIX? What's a PREFIX? The compiler hasn't worked that out yet. It certainly doesn't know it's a string. It very certainly doesn't know what it's value is.

And even if you just fudge it so that simple cases like that work, all I have to do is put the value behind another layer of indirection and suddenly it stops working.

What're you talking about? It is multiplying by two.

*suspicious cough*

@DanielKeep You seem stressed, come down and relax a bit :sunglasses:

Whoops! Sorry. Was looking at it on a small phone screen yesterday, and somehow missed the "2 *" :hushed:

[quote="DanielKeep, post:21, topic:4472"]
A better example would have been to mixin a new function that you then call as part of generating another mixin function. [/quote]
Rust syntax extensions can produce AST that contains other macros. Which could happen to be another instances on my hypothetical compiling syntax extension.

PREFIX could have been a macro that expands to a string.

I believe that your examples so far could be made to work without access to results of the type inference pass, or even the name resolution pass.

Now, if one could reflect on a type of a local variable, whose type is inferred... but can D do that?

And one more for D: it supports design by contract Contract Programming - D Programming Language

It's unfinished, buggy, and if you don't have some help from the compiler that catches some precondition/invariant violations at compile-time, they are not much better than just asserts... (and I use DbC in D a lot).

Walter Bright (language creator) has a pending

that will add support for lifetime analysis of scoped pointers.

Described here:

https://github.com/dlang/DIPs/blob/master/DIPs/DIP1000.md

3 Likes

Walter has also said repeatedly that DIP1000 is very different than Rust, and assuming any similarity will lead to much confusion. It's certainly related work, but it's not the same.

1 Like

I see now this is written quite some time ago, but for documentation purposes I'll just say that things have happened since 2016:

(I can't post more than 2 links so)

  • [2.095.0](/2.095.0.html) (Jan 01, 2021)
  • [2.094.2](/2.094.2.html) (Nov 20, 2020)
  • [2.094.1](/2.094.1.html) (Oct 18, 2020)
  • [2.094.0](/2.094.0.html) (Sep 22, 2020)
  • [2.093.1](/2.093.1.html) (Aug 15, 2020)
  • [2.093.0](/2.093.0.html) (Jul 07, 2020)
  • [2.092.1](/2.092.1.html) (Jun 10, 2020)
  • [2.092.0](/2.092.0.html) (May 10, 2020)
  • [2.091.1](/2.091.1.html) (Apr 17, 2020)
  • [2.091.0](/2.091.0.html) (Mar 08, 2020)
  • [2.090.1](/2.090.1.html) (Feb 06, 2020)
  • [2.090.0](/2.090.0.html) (Jan 05, 2020)
  • [2.089.1](/2.089.1.html) (Dec 14, 2019)
  • [2.089.0](/2.089.0.html) (Nov 02, 2019)
  • [2.088.1](/2.088.1.html) (Oct 11, 2019)
  • [2.088.0](/2.088.0.html) (Sep 01, 2019)
  • [2.087.1](/2.087.1.html) (Aug 04, 2019)
  • [2.087.0](/2.087.0.html) (Jul 01, 2019)
  • [2.086.1](/2.086.1.html) (Jun 15, 2019)
  • [2.086.0](/2.086.0.html) (May 04, 2019)
  • [2.085.1](/2.085.1.html) (Apr 05, 2019)
  • [2.085.0](/2.085.0.html) (Mar 01, 2019)
  • [2.084.1](/2.084.1.html) (Feb 09, 2019)
  • [2.084.0](/2.084.0.html) (Jan 01, 2019)
  • [2.083.1](/2.083.1.html) (Dec 08, 2018)
  • [2.083.0](/2.083.0.html) (Nov 01, 2018)
  • [2.082.1](/2.082.1.html) (Oct 10, 2018)
  • [2.082.0](/2.082.0.html) (Sep 01, 2018)
  • [2.081.2](/2.081.2.html) (Aug 12, 2018)
  • [2.081.1](/2.081.1.html) (Jul 10, 2018)
  • [2.081.0](/2.081.0.html) (Jul 01, 2018)
  • [2.080.1](/2.080.1.html) (Jun 07, 2018)
  • [2.080.0](/2.080.0.html) (May 01, 2018)
  • [2.079.1](/2.079.1.html) (Apr 14, 2018)
  • [2.079.0](/2.079.0.html) (Mar 01, 2018)
  • [2.078.3](/2.078.3.html) (Feb 15, 2018)
  • [2.078.2](/2.078.2.html) (Feb 07, 2018)
  • [2.078.1](/2.078.1.html) (Jan 21, 2018)
  • [2.078.0](/2.078.0.html) (Jan 01, 2018)
  • [2.077.1](/2.077.1.html) (Nov 29, 2017)
  • [2.077.0](/2.077.0.html) (Nov 1, 2017)
  • [2.076.1](/2.076.1.html) (Oct 09, 2017)
  • [2.076.0](/2.076.0.html) (Sep 1, 2017)
  • [2.075.1](/2.075.1.html) (Aug 11, 2017)
  • [2.075.0](/2.075.0.html) (Jul 19, 2017)
  • [2.074.1](/2.074.1.html) (May 30, 2017)
  • [2.074.0](/2.074.0.html) (Apr 10, 2017)
  • [2.073.2](/2.073.2.html) (Mar 09, 2017)
  • [2.073.1](/2.073.1.html) (Feb 16, 2017)
  • [2.073.0](/2.073.0.html) (Jan 22, 2017)
  • [2.072.2](/2.072.2.html) (Dec 31, 2016)
  • [2.072.1](/2.072.1.html) (Nov 30, 2016)
  • [2.072.0](/2.072.0.html) (Oct 30, 2016)
  • [2.071.2](/2.071.2.html) (September 19, 2016)
  • [2.071.1](/2.071.1.html) (June 27, 2016)
  • [2.071.0](/2.071.0.html) (Apr 5, 2016)
  • [2.070.2](/2.070.2.html) (Mar 3, 2016)
  • [2.070.1](/2.070.1.html) (Feb 27, 2016)
  • [2.070.0](/2.070.0.html) (Jan 27, 2016)

D has matured quite a lot and now has many ways of using C++ and even Objective-C. Also D got merged into GCC. And D has 3 compilers, DMD, GDC (GCC) and LDC (LVVM).

Some links:
Package dpp version 0.4.2 - DUB - The D package registry (dlang.org) and dstep

Interfacing to Objective-C - D Programming Language (dlang.org)

Just putting some info out there for anyone curious.
Language wars are pointless, just wanted to share for anyone interested.

Sadly they often degenerate into mud slinging.

On the other hand they can be fascinating. With one side claiming features that are poorly supported by the other or not at all, and vice versa.

Quite often features I have never heard of and never knew I needed in decades of writing software.

2 Likes

This topic was automatically closed 30 days after the last reply. We invite you to open a new topic if you have further questions or comments.