poke-devel
[Top][All Lists]
Advanced

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

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


From: Carlo Caione
Subject: Re: [PATCH] repl: Enable auto-completion for structs
Date: Fri, 14 Feb 2020 14:19:40 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 14/02/2020 13:02, Jose E. Marchesi wrote:

Hi Carlo!

Hey there,

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?)
cases.

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.

I didn't investigate this way but I definitely prefer it than having to compile the statement.

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.

WDYT?

I can investigate this approach. For sure it requires a bit of digging into the internals. I'll keep you posted.

Cheers,

--
Carlo Caione



reply via email to

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