The best way to write IDE helper tool
Basile B.
b2.temp at gmx.com
Sat Dec 22 17:14:12 UTC 2018
On Thursday, 20 December 2018 at 18:21:55 UTC, Andre Pany wrote:
> On Thursday, 20 December 2018 at 14:17:11 UTC, unDEFER wrote:
>> Hello!
>> I know there is IDE tools like DCD, but I don't like it
>> because it hasn't UCFS-suggestions.
>> So I have written my own patches to DMD to decide this
>> problem. The patches adds the "-interp" option to compiler. In
>> this mode the compiler is interrupted after semantic3 stage
>> and displays the next prompt:
>>
>> [...]
>
> Without knowing the details I assume dcd is using libdparse and
> here some features are missing.
> If we could add the missing features to libdparse, dcd and also
> other tools would immediately profit (dscanner, dfrmt,...)
>
> Kind regards
> Andre
Unfortunately he's right about dparse. Dparse and dsymbols are
really far from being able to give correct UFCS suggestions
because
1. it does not do the semantic of expressions and statements
This basically means that CTFE is not possible (mixin, static
if) because before
intepreting the expressions they must be analyzed but most
importantly this means
that the return type of auto functions cant be infered (it
relies on the type of
the expression wrapped in a return statement).
2. it does not instantiate templates
AST copy and patch parameter with instances.
So for now any attempt to implement UFCS suggestions will work to
a very limited extant when trying to be type-correct. Some rules
could be applied such as "if the type of the first parameter is
not known then presume that by default it will work" but then the
suggestions will be mostly wrong.
If someone wants to give a try there's been an attempt from
Soulaimane last year:
https://github.com/SSoulaimane/dcd/commit/dc666817139e6fc135a6d02dc4dc63406aeca439
More information about the Digitalmars-d
mailing list