Re: About the indy implementation

2019-12-28 Thread Jochen Theodorou

On 28.12.19 19:25, Daniel.Sun wrote:

Hi all,

As Groovy 4 will focus on indy and eliminate the old call sites, I am
trying to walk through the implementation of indy...
Could you tell me why setting property is not supported in indy? It
is in TODO list, or not supported on purpose? Thanks in advance :-)


I am afraid I don't know anymore. I was replacing the existing callsite
caching and that does not handle property-set either. I vaguely remember
I had a problem with the MOP that prevented me to just implement a
direct call for the setter... but that does not mean the problem was
really an issue. I learned a lot while implementing the indy-part and
changed it quite a bit. It is very possible I just never got back to it.

bye Jochen



About the indy implementation

2019-12-28 Thread Daniel.Sun
Hi all,

   As Groovy 4 will focus on indy and eliminate the old call sites, I am
trying to walk through the implementation of indy...
   Could you tell me why setting property is not supported in indy? It
is in TODO list, or not supported on purpose? Thanks in advance :-)

```
public static Selector getSelector(MutableCallSite callSite, Class
sender, String methodName, int callID, boolean safeNavigation, boolean
thisCall, boolean spreadCall, Object[] arguments) {
CALL_TYPES callType = CALL_TYPES_VALUES[callID];
switch (callType) {
case INIT: return new InitSelector(callSite, sender, methodName,
callType, safeNavigation, thisCall, spreadCall, arguments);
case METHOD: return new MethodSelector(callSite, sender,
methodName, callType, safeNavigation, thisCall, spreadCall, arguments);
case GET: 
return new PropertySelector(callSite, sender, methodName,
callType, safeNavigation, thisCall, spreadCall, arguments);
case SET:
throw new GroovyBugError("your call tried to do a property
set, which is not supported.");
case CAST:  return new CastSelector(callSite, arguments);
default: throw new GroovyBugError("unexpected call type");
}
}
```
(
https://github.com/apache/groovy/blob/master/src/main/java/org/codehaus/groovy/vmplugin/v7/Selector.java#L132
)

Cheers,
Daniel.Sun



-
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html