IEvaluatedType representing an Array of a certain type [message #8205] |
Fri, 29 June 2007 19:58  |
Eclipse User |
|
|
|
All,
I'm trying to implement my own IGoalEvaluatorFactory, and am having some
luck with regular types.
How can I return an IEvaluatedType representing and Array of a certain type?
I only see the other evaluators returning 'new RubyClassType("Array")',
which doesn't specify the Type of the contents of the Array.
This makes it so completing at the end of "myArray[0]." doesn't have type
information.
Am I missing something here?
Thank You,
Shelby Sanders
|
|
|
Re: IEvaluatedType representing an Array of a certain type [message #8236 is a reply to message #8205] |
Mon, 02 July 2007 04:30   |
Eclipse User |
|
|
|
Originally posted by: fourdman.xored.com
Hi,
By now DLTK Ruby doesn't infer types of array's contents. So there is no
IEvaluatedType implementation of such thing as "array of a certain type".
First solution, that I see, is to create RubyClassType descendant that
will have "Array%" as model key and additionally will store information
of array content type. Of course, you'll need to create such
IEvaluatedType everywhere, where variable type was inferred as Array.
Second solution is to use RubyClassType("Array") and infer array content
type only when nodes like myArray[0] are found. So no additional
IEvaluatedType are required. But I don't think that it's a good solution.
Please, feel free to ask more about this, cause I'm not sure, that I've
correctly understood your problem.
Shelby Sanders wrote:
> All,
>
> I'm trying to implement my own IGoalEvaluatorFactory, and am having some
> luck with regular types.
>
> How can I return an IEvaluatedType representing and Array of a certain type?
> I only see the other evaluators returning 'new RubyClassType("Array")',
> which doesn't specify the Type of the contents of the Array.
>
> This makes it so completing at the end of "myArray[0]." doesn't have type
> information.
>
> Am I missing something here?
>
> Thank You,
> Shelby Sanders
>
|
|
|
Re: IEvaluatedType representing an Array of a certain type [message #8299 is a reply to message #8236] |
Mon, 02 July 2007 17:16  |
Eclipse User |
|
|
|
Mikhail,
Actually, it sounds like you do understand the situation. I just wanted to
confirm that there wasn't already a way of doing this which I happened to
overlooking.
I was thinking of extending RubyClassType with something like RubyArrayType,
so that everything which already expects a RubyClassType will still work.
This is basically the first solution you mentioned. Then, the evaluator
clients which can leverage the additional information can downcast to
RubyArrayType.
I agree, the second possibility seems like it would cause more problems than
it solves.
Is someone already working on adding this type of support? If not, I'll
give it a try, and contribute as a patch.
~Shelby
> Hi,
>
> By now DLTK Ruby doesn't infer types of array's contents. So there is no
> IEvaluatedType implementation of such thing as "array of a certain type".
>
> First solution, that I see, is to create RubyClassType descendant that
> will have "Array%" as model key and additionally will store information
> of array content type. Of course, you'll need to create such
> IEvaluatedType everywhere, where variable type was inferred as Array.
>
> Second solution is to use RubyClassType("Array") and infer array content
> type only when nodes like myArray[0] are found. So no additional
> IEvaluatedType are required. But I don't think that it's a good solution.
>
> Please, feel free to ask more about this, cause I'm not sure, that I've
> correctly understood your problem.
>
> Shelby Sanders wrote:
>> All,
>>
>> I'm trying to implement my own IGoalEvaluatorFactory, and am having some
>> luck with regular types.
>>
>> How can I return an IEvaluatedType representing and Array of a certain type?
>> I only see the other evaluators returning 'new RubyClassType("Array")',
>> which doesn't specify the Type of the contents of the Array.
>>
>> This makes it so completing at the end of "myArray[0]." doesn't have type
>> information.
>>
>> Am I missing something here?
>>
>> Thank You,
>> Shelby Sanders
|
|
|
Powered by
FUDForum. Page generated in 0.03773 seconds