Because you might be dealing with an array that came from somewhere else. 
Unless we deliberately blur the lines between Vectors and Arrays, it’s going to 
cause type errors.

It could be that we might be able to “fake” it on the JS side (not even sure 
about that), but on the SWF side I don’t see how that can work.

> On Feb 27, 2017, at 7:28 AM, Alex Harui <aha...@adobe.com> wrote:
> 
> Yes, please file a JIRA.
> 
> Since we're on the subject, why wouldn't Vector be a good equivalent of
> typed arrays?
> 
> Thanks,
> -Alex
> 
> On 2/26/17, 11:23 AM, "Harbs" <harbs.li...@gmail.com 
> <mailto:harbs.li...@gmail.com>> wrote:
> 
>> I already worked around it for now, but it’s something that should
>> probably be resolved.
>> 
>> Do you want me to create a JIRA for this?
>> 
>>> On Feb 26, 2017, at 8:59 PM, Alex Harui <aha...@adobe.com> wrote:
>>> 
>>> Has the jsdoc syntax of "type[]" been used elsewhere?  It is likely that
>>> externc didn't know to expect it.
>>> 
>>> For now, you can patch your .js file to just claim to return an array.
>>> Lots of our other typedefs hack the .js file before pushing it through
>>> externc.
>>> 
>>> -Alex
>>> 
>>> On 2/26/17, 10:42 AM, "Harbs" <harbs.li...@gmail.com
>>> <mailto:harbs.li...@gmail.com>> wrote:
>>> 
>>>> Yes. I put it though externc.
>>>> 
>>>> Here’s the ActionScript output for the method:
>>>>  /**
>>>>   * Convert the given text to a list of Glyph objects.
>>>>   * Note that there is no strict one-to-one mapping between characters
>>>> and
>>>>   * glyphs, so the list of returned glyphs can be larger or smaller
>>>> than the
>>>>   * length of the given string.
>>>>   *
>>>>   * @param s [string]
>>>>   * @see [opentype]
>>>>   * @returns {(null|opentype.Glyph)} ]}
>>>>   */
>>>>  public function stringToGlyphs(s:String):opentype.Glyph {  return
>>>> null; }
>>>> 
>>>> That definitely looks wrong.
>>>> 
>>>> I’m not sure what it’s supposed to do. Unless we introduce Typed
>>>> Arrays,
>>>> probably just converting it to a simple Array is the safest way to go.
>>>> I
>>>> don’t think Vector will translate very well.
>>>> 
>>>>> On Feb 26, 2017, at 6:36 PM, Alex Harui <aha...@adobe.com 
>>>>> <mailto:aha...@adobe.com>> wrote:
>>>>> 
>>>>> 
>>>>> 
>>>>> On 2/25/17, 11:42 PM, "Harbs" <harbs.li...@gmail.com 
>>>>> <mailto:harbs.li...@gmail.com>
>>>>> <mailto:harbs.li...@gmail.com <mailto:harbs.li...@gmail.com> 
>>>>> <mailto:harbs.li...@gmail.com <mailto:harbs.li...@gmail.com>>>> wrote:
>>>>> 
>>>>>> I have the following in an extern:
>>>>>> 
>>>>>> /**
>>>>>> * Convert the given text to a list of Glyph objects.
>>>>>> * Note that there is no strict one-to-one mapping between characters
>>>>>> and
>>>>>> * glyphs, so the list of returned glyphs can be larger or smaller
>>>>>> than
>>>>>> the
>>>>>> * length of the given string.
>>>>>> * @param  {string} s
>>>>>> * @param  {Object=} options
>>>>>> * @return {opentype.Glyph[]}
>>>>>> */
>>>>>> opentype.Font.prototype.stringToGlyphs = function(s, options) {};
>>>>>> 
>>>>>> The function returns an array of opentype.Glyph objects.
>>>>>> 
>>>>>> When I try compile a call to this function, I get the following error
>>>>>> (in
>>>>>> compc):
>>>>>> "Implicit coercion of a value of type Glyph to an unrelated type
>>>>>> Array."
>>>>>> 
>>>>>> This seems to me like it’s probably a bug.
>>>>> 
>>>>> I'm guessing you first put this code throughout externc?  What is the
>>>>> .as
>>>>> output?  Has externc handled other typed arrays correctly? Is it
>>>>> supposed
>>>>> to convert it to a Vector?
>>>>> 
>>>>> -Alex

Reply via email to