Dynamic arrays broke?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic arrays broke?

Jacob Wagner
  I apologize in advance if I'm doing something wrong or missed some documentation/discussion recently. 
I'm having trouble using dynamic arrays in a game engine I'm using (pulse game engine) with amber.  
I narrowed the problem down to this example:

#{ 
       #url -> 'foo.html'. 
       #success -> [:data | console log: data] 
}.

<{url: 'foo.html', success: function(data){console.log(data)}}>.

inspecting the top object does not seem to give the proper result, i.e. the keys do not include #url and #success.  the bottom object seems to work fine.  
<zenchess@gmail.com>
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic arrays broke?

Jacob Wagner
  Oops, I meant dynamic dictionaries.  Getting the code from this page: 
http://nicolas-petton.fr/2011/09/06/Dynamic-arrays-in-Jtalk.html
<zenchess@gmail.com>
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic arrays broke?

Nicolas Petton
In reply to this post by Jacob Wagner
This is because the #{...} literal syntax creates HashedCollection
objects, which only support strings as keys.

The following works fine:

#{
        'url' -> 'foo.html'.
        'success' -> [:data | console log: data]
}.

Cheers!
Nico

Zenchess <[hidden email]> writes:

>   I apologize in advance if I'm doing something wrong or missed some
> documentation/discussion recently.
> I'm having trouble using dynamic arrays in a game engine I'm using (pulse
> game engine) with amber.  
> I narrowed the problem down to this example:
>
> #{
>        #url -> 'foo.html'.
>        #success -> [:data | console log: data]
> }.
>
> <{url: 'foo.html', success: function(data){console.log(data)}}>.
>
> inspecting the top object does not seem to give the proper result, i.e. the
> keys do not include #url and #success.  the bottom object seems to work
> fine.  

--
Nicolas Petton
http://nicolas-petton.fr