Skip to main content



      Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » ExtendedVariableReference and CallHolder vs. CallExpression and MethodCallExpression
ExtendedVariableReference and CallHolder vs. CallExpression and MethodCallExpression [message #26134] Wed, 18 June 2008 12:11 Go to next message
Eclipse UserFriend
Your full sample editor uses ExtendedVariableReference and CallHolder,
but other internal code appears to use CallExpression and
MethodCallExpression instead.
Should I switch my code to be using CallExpression/MethodCallExpression
instead?

Chuck
Re: ExtendedVariableReference and CallHolder vs. CallExpression and MethodCallExpression [message #26177 is a reply to message #26134] Wed, 18 June 2008 13:08 Go to previous messageGo to next message
Eclipse UserFriend
Also, if I do try to use CallExpression instead of CallHolder (which only
holds the arguments),
what is the receiver - is it the object that you are operating on, i.e.
this, whose type defines the method? In CallExpression, it is an ASTNode. I
would have thought it would be an expression instead.

Chuck

"Chuck Doucette" <cdoucette@vaultus.com> wrote in message
news:g3bc5r$u8c$1@build.eclipse.org...
> Your full sample editor uses ExtendedVariableReference and CallHolder,
> but other internal code appears to use CallExpression and
> MethodCallExpression instead.
> Should I switch my code to be using CallExpression/MethodCallExpression
> instead?
>
> Chuck
>
>
Re: ExtendedVariableReference and CallHolder vs. CallExpression and MethodCallExpression [message #26218 is a reply to message #26177] Thu, 19 June 2008 04:29 Go to previous message
Eclipse UserFriend
Hi Chuck,

CallExpression is part of the dltk.core, but ExtendedVariableReference
and CallHolder are specific to the python.

The framework declare base classes for the AST to allow core support for
common functionality - search, outline, call & type hierarchies, etc.

In case of the CallExpression the implicit "this" parameter is usually
stored as null to the receiver. In scripting languages it is usually
impossible to distinguish instance vs static methods during parsing
phase, so it is implemented that way.

For example, the expression

print("hello")

will have:

receiver=null
name=SimpleReference("print")
args=[StringLiteral("hello")]

and the expression

output.print("hello")

will be

receiver=VariableReference("output")
name=SimpleReference("print")
args=[StringLiteral("hello")]

The receiver is declared as ASTNode because it is the base case in the
hierarchy. The situation with Statement/Expression is complex because
various languages have different notions of what an 'expression' and a
'statement' are. Probably we will merge this classes in the future. The
ASTNode is the most general case. The future of the AST class hierarchy
is often discussed, so this is not the "final" solution, it can (and
most probably will) be changed at some time.

Regards,
Alex


Chuck Doucette wrote:
> Also, if I do try to use CallExpression instead of CallHolder (which only
> holds the arguments),
> what is the receiver - is it the object that you are operating on, i.e.
> this, whose type defines the method? In CallExpression, it is an ASTNode. I
> would have thought it would be an expression instead.
>
> Chuck
>
> "Chuck Doucette" <cdoucette@vaultus.com> wrote in message
> news:g3bc5r$u8c$1@build.eclipse.org...
>> Your full sample editor uses ExtendedVariableReference and CallHolder,
>> but other internal code appears to use CallExpression and
>> MethodCallExpression instead.
>> Should I switch my code to be using CallExpression/MethodCallExpression
>> instead?
>>
>> Chuck
Previous Topic:capturing output of remote run process
Next Topic:Tutorials/guides
Goto Forum:
  


Current Time: Wed Jul 09 14:16:40 EDT 2025

Powered by FUDForum. Page generated in 0.26500 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top