Common functionality for dynamic languages

Denis Steckelmacher steckdenis at yahoo.fr
Wed Apr 16 20:23:35 UTC 2014


Hi,

On 04/16/2014 09:36 PM, Sven Brauch wrote:
>   - The container types: They make it possible to track T for List<T> for a T
> which is not static. There's also a type for hashmap-like objects which can
> track P and Q in Map<P, Q>. I think this might be especially interesting for
> PHP and JS; Ruby already uses its own (extended) copy and will eventually port
> to the new base class.
> See language/duchain/types/containertypes.h in KDevPlatform.

Wonderful! I was thinking about how to implement hash maps and list in 
JS, and I will need these classes at least for the lists (I still 
haven't figured out how to handle hash maps and code-completion for 
them, maybe subclassing MapType could be the way to go).

>
>   - A base expression visitor for finding the type of an expression. This is
> another thing which is reimplemented from scratch for each dynamic language
> and looks almost the same, so I think it would be good to share a common base.
> Especially increased consistency across language plugins would be nice here.
> See language/duchain/builders/dynamiclanguageexpressionvisitor.h in
> KDevPlatform.

This is interesting. There is not much that can be factorized between 
the dynamic languages, because ExpressionVisitor is highly dependent on 
the AST of the language, but I think that what you have factorized out 
can already lead to a good reduction of duplicated code between the 
dynamic languages.

>
> I'm writing this email so interested parties can review the API; I'd be happy
> to modify it to make it useful for other languages.

Thanks for this hard work! I will port the JS language support to these 
new classes whenever possible. Regarding the API, I can say that 
everything that the JS parser will already use seems to have the right 
API. I still cannot judge the API of MapType and ListType, but it seems 
well-thought and practical.

Denis Steckelmacher



More information about the KDevelop-devel mailing list