[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] repl: Enable auto-completion for structs

From: Jose E. Marchesi
Subject: Re: [PATCH] repl: Enable auto-completion for structs
Date: Fri, 14 Feb 2020 13:02:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi Carlo!

Ah, the can of worms that is auto-completion... I'm glad you are opening
it, thanks for that :)

I see you are using the logical approach, which is to make use of both
compile-time information (from the compiler's environment) and run-time
information (evaluating stuff in the PVM).

Poke expressions, however, can have side-effects.  Also, given the fact
Poke is a statically typed language, I believe it should be possible to
restrict the auto-completion to compile-time information in many (most?)

For example,

    +      /* we need to compile the statement to expand nested structs (i.e. 
XX.YY.) */
    +      ret = pkl_compile_statement (poke_compiler, ecmd, &end, &val);

Wouldn't it be possible to traverse the type of the AST node for XX,
down to the leave YY?  That will give you the type of YY, without
needing to evaluate anything in the PVM.

If we take that approach, the code traversing these nodes would need to
be in pkl-ast.c, and made available through auto-completion services in
the compiler interface (pkl.h), that the repl (and in the future other
modules, like a machine-interface) can use.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]