[Ometa] ometa on IE - is a string necesarrily an array of characters?

Alessandro Warth alexwarth at gmail.com
Mon Jul 6 12:10:04 PDT 2009


Hi R=FCdiger,
I think you're right... if IE doesn't let you access the ith character of a
string using the array-access syntax (e.g., s[i]) this won't work. Oops :)

Unfortunately I don't have a windows machine handy right now, but here's
something you could try:

function ArrayOMInputStream(arr, idx) {
  this.memo =3D { }
  this.arr  =3D arr
  this.idx  =3D idx
  this.hd   =3D this.charAt ? this.charAt(idx) : arr[idx]
}

And you could leave the line that you modified
(String.prototype.toOMInputStream
=3D ...) the way it was before.

Please let me know if this works, and if so, I'll provide a proper fix that
will perform better than this one.

Thanks,
Alex

On Fri, Jul 3, 2009 at 12:18 PM, R=FCdiger Plantiko <
ruediger.plantiko at astrotexte.ch> wrote:

> Hello Alex,
>
> I searched a bit for the cause why your {OMeta-JS} 2.0 doesn't work on IE
> (neither v.7 nor 8), whereas it *does* work in Firefox and Google Chrome.
>
> I found out that one of the reasons is that you delegate
> String.prototype.toOMInputStream =3D Array.prototype.toOMInputStream
>
> therefor implicitly assuming that a string is an array of characters, i.e.
> you assume
>
> "x"[0] =3D=3D "x"
>
> which holds for the Chrome and FF implementations, but not for IE. It see=
ms
> that this is an assumption which is left free as an implementation detail=
 to
> the interpreter developers.
>
> I changed the above statement to
>
> String.prototype.toOMInputStream =3D ("x"[0] =3D=3D 'x') ?
> Array.prototype.toOMInputStream : function() { return
> makeArrayOMInputStream(this.split(''), 0)  }
> which made the things a bit better. But still it hangs somewhere. In IE 8,
> one could use the built-in debugger to find out the cause that it still
> fails. But I must admit that I got lost in all these "$elf" and "_apply()=
"s,
> being somewhere in the 27th level of "anonymous function"s in the
> callstack...
>
> Can you give a hint which place of the code would be a good candidate for=
 a
> break-point? I want to trace the failure of such a simple statement as
>
> ometa M {}
>
> i.e. I am still in the translation phase of the OMeta clause which preced=
es
> the execution.
>
> Thanks for any help in this matter!
>
> Regards,
> R=FCdiger
>
>
> _______________________________________________
> OMeta mailing list
> OMeta at vpri.org
> http://vpri.org/mailman/listinfo/ometa
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://vpri.org/pipermail/ometa/attachments/20090706/633c9b17/attachme=
nt.htm


More information about the OMeta mailing list