Initializing a new JavaScript object

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

Initializing a new JavaScript object

Ankh'nAton
Hi everybody,

how comes, I cannot evaluate the following in the workspace...

jsObj := <{}>.

All I get is an alert() saying: "Parse error on line 1 column 17 :
Unexpected character <"

Any suggestions?

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

xekoukou
The new interpreter doesnt allow to have both smalltalk and javascript code at the same method or workspace.

2013/2/14 Tom <[hidden email]>
Hi everybody,

how comes, I cannot evaluate the following in the workspace...

jsObj := <{}>.

All I get is an alert() saying: "Parse error on line 1 column 17 :
Unexpected character <"

Any suggestions?

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.





--

Sincerely yours, 
     Apostolis Xekoukoulotakis

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

xekoukou
Use a HashedCollection object instead. I think it is exactly the same.

2013/2/14 Apostolis Xekoukoulotakis <[hidden email]>
The new interpreter doesnt allow to have both smalltalk and javascript code at the same method or workspace.


2013/2/14 Tom <[hidden email]>
Hi everybody,

how comes, I cannot evaluate the following in the workspace...

jsObj := <{}>.

All I get is an alert() saying: "Parse error on line 1 column 17 :
Unexpected character <"

Any suggestions?

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.





--

Sincerely yours, 
     Apostolis Xekoukoulotakis



--

Sincerely yours, 
     Apostolis Xekoukoulotakis

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

Ankh'nAton
You mean...

jsObj := #().
jsObj at: #x put: 23.

???

On 14 Feb., 16:06, Apostolis Xekoukoulotakis <[hidden email]>
wrote:

> Use a HashedCollection object instead. I think it is exactly the same.
>
> 2013/2/14 Apostolis Xekoukoulotakis <[hidden email]>
>
>
>
>
>
>
>
>
>
> > The new interpreter doesnt allow to have both smalltalk and javascript
> > code at the same method or workspace.
>
> > 2013/2/14 Tom <[hidden email]>
>
> >> Hi everybody,
>
> >> how comes, I cannot evaluate the following in the workspace...
>
> >> jsObj := <{}>.
>
> >> All I get is an alert() saying: "Parse error on line 1 column 17 :
> >> Unexpected character <"
>
> >> Any suggestions?
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "amber-lang" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an
> >> email to [hidden email].
> >> For more options, visithttps://groups.google.com/groups/opt_out.
>
> > --
>
> > Sincerely yours,
>
> >      Apostolis Xekoukoulotakis
>
> --
>
> Sincerely yours,
>
>      Apostolis Xekoukoulotakis

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

Herby Vojčík
In reply to this post by xekoukou


Apostolis Xekoukoulotakis wrote:
> Use a HashedCollection object instead. I think it is exactly the same.

Not _exactly_ (HashedCollection is deeper subclass, it is not wrapping
plain JS Object), but it can be used in lots of places instead of plain
object (jQuery options, css etc., all works).

> 2013/2/14 Apostolis Xekoukoulotakis <[hidden email]
> <mailto:[hidden email]>>
>
>     The new interpreter doesnt allow to have both smalltalk and
>     javascript code at the same method or workspace.
>
>
>     2013/2/14 Tom <[hidden email] <mailto:[hidden email]>>
>
>         Hi everybody,
>
>         how comes, I cannot evaluate the following in the workspace...
>
>         jsObj := <{}>.
>
>         All I get is an alert() saying: "Parse error on line 1 column 17 :
>         Unexpected character <"
>
>         Any suggestions?
>
>         --
>         You received this message because you are subscribed to the
>         Google Groups "amber-lang" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to [hidden email]
>         <mailto:amber-lang%[hidden email]>.
>         For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
>
>     --
>
>
>     Sincerely yours,
>
>           Apostolis Xekoukoulotakis
>
>
>
>
> --
>
>
> Sincerely yours,
>
>       Apostolis Xekoukoulotakis
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

Herby Vojčík
In reply to this post by Ankh'nAton


Tom wrote:
> You mean...
>
> jsObj := #().
> jsObj at: #x put: 23.

jsObj := #{ 'x'->23. 'y'->42 }.
Use must use string, #x not supported (there is an issue for that).

> ???
>
> On 14 Feb., 16:06, Apostolis Xekoukoulotakis<[hidden email]>
> wrote:
>> Use a HashedCollection object instead. I think it is exactly the same.
>>
>> 2013/2/14 Apostolis Xekoukoulotakis<[hidden email]>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> The new interpreter doesnt allow to have both smalltalk and javascript
>>> code at the same method or workspace.
>>> 2013/2/14 Tom<[hidden email]>
>>>> Hi everybody,
>>>> how comes, I cannot evaluate the following in the workspace...
>>>> jsObj :=<{}>.
>>>> All I get is an alert() saying: "Parse error on line 1 column 17 :
>>>> Unexpected character<"
>>>> Any suggestions?
>>>> --
>>>> You received this message because you are subscribed to the Google Groups
>>>> "amber-lang" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>> email to [hidden email].
>>>> For more options, visithttps://groups.google.com/groups/opt_out.
>>> --
>>> Sincerely yours,
>>>       Apostolis Xekoukoulotakis
>> --
>>
>> Sincerely yours,
>>
>>       Apostolis Xekoukoulotakis
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

Ankh'nAton
In reply to this post by Herby Vojčík
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:

> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>
> Not _exactly_ (HashedCollection is deeper subclass, it is not wrapping
> plain JS Object), but it can be used in lots of places instead of plain
> object (jQuery options, css etc., all works).
>
>
>
>
>
>
>
> > 2013/2/14 Apostolis Xekoukoulotakis <[hidden email]
> > <mailto:[hidden email]>>
>
> >     The new interpreter doesnt allow to have both smalltalk and
> >     javascript code at the same method or workspace.
>
> >     2013/2/14 Tom <[hidden email] <mailto:[hidden email]>>
>
> >         Hi everybody,
>
> >         how comes, I cannot evaluate the following in the workspace...
>
> >         jsObj := <{}>.
>
> >         All I get is an alert() saying: "Parse error on line 1 column 17 :
> >         Unexpected character <"
>
> >         Any suggestions?
>
> >         --
> >         You received this message because you are subscribed to the
> >         Google Groups "amber-lang" group.
> >         To unsubscribe from this group and stop receiving emails from
> >         it, send an email to [hidden email]
> >         <mailto:amber-lang%[hidden email]>.
> >         For more options, visithttps://groups.google.com/groups/opt_out.
>
> >     --
>
> >     Sincerely yours,
>
> >           Apostolis Xekoukoulotakis
>
> > --
>
> > Sincerely yours,
>
> >       Apostolis Xekoukoulotakis
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "amber-lang" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [hidden email].
> > For more options, visithttps://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

xekoukou
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <[hidden email]>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>
> Not _exactly_ (HashedCollection is deeper subclass, it is not wrapping
> plain JS Object), but it can be used in lots of places instead of plain
> object (jQuery options, css etc., all works).
>
>
>
>
>
>
>
> > 2013/2/14 Apostolis Xekoukoulotakis <[hidden email]
> > <mailto:[hidden email]>>
>
> >     The new interpreter doesnt allow to have both smalltalk and
> >     javascript code at the same method or workspace.
>
> >     2013/2/14 Tom <[hidden email] <mailto:[hidden email]>>
>
> >         Hi everybody,
>
> >         how comes, I cannot evaluate the following in the workspace...
>
> >         jsObj := <{}>.
>
> >         All I get is an alert() saying: "Parse error on line 1 column 17 :
> >         Unexpected character <"
>
> >         Any suggestions?
>
> >         --
> >         You received this message because you are subscribed to the
> >         Google Groups "amber-lang" group.
> >         To unsubscribe from this group and stop receiving emails from
> >         it, send an email to [hidden email]
> >         <mailto:[hidden email]>.
> >         For more options, visithttps://groups.google.com/groups/opt_out.
>
> >     --
>
> >     Sincerely yours,
>
> >           Apostolis Xekoukoulotakis
>
> > --
>
> > Sincerely yours,
>
> >       Apostolis Xekoukoulotakis
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "amber-lang" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [hidden email].
> > For more options, visithttps://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.





--

Sincerely yours, 
     Apostolis Xekoukoulotakis

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

Herby Vojčík


Apostolis Xekoukoulotakis wrote:
> Ok. Inspecting on both objects though gives a HashedCollection so maybe
> inspection is not accurate enough.
??? Can you elaborate more. The code you entered below creates
HashedCollection in first assigment (but at once), and new
HashedCollection (but stepwise) in the other three. None of it is plain
JS Object.

> |jsObj|
> jsObj := #{ 'x'->23. 'y'->42 }.
> jsObj:=HashedCollection new.
> jsObj at:'x' put:23.
> jsObj at:'y' put:42;yourself.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

xekoukou
I thought the first one was a jsObject. I don't understand the amber internals very well at this point. Using a hashedCollection has worked for me too, so I dont know when a jsObject might be required.

2013/2/14 Herby Vojčík <[hidden email]>


Apostolis Xekoukoulotakis wrote:
Ok. Inspecting on both objects though gives a HashedCollection so maybe
inspection is not accurate enough.
??? Can you elaborate more. The code you entered below creates HashedCollection in first assigment (but at once), and new HashedCollection (but stepwise) in the other three. None of it is plain JS Object.


|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.





--

Sincerely yours, 
     Apostolis Xekoukoulotakis

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

Herby Vojčík


Apostolis Xekoukoulotakis wrote:
> I thought the first one was a jsObject. I don't understand the amber
> internals very well at this point. Using a hashedCollection has worked
> for me too, so I dont know when a jsObject might be required.

#{ 'xx'->yy. 'zz'->qq } is syntax for shortcut creation of HashedCollection.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

SebastianHC
In reply to this post by xekoukou
Hi,

 I just upgrade some older amber stuff of mine to the most current version.

I do have a problem with inlining and I do not know how to reimplement it in the current version.


    | data |
   <data = {}>.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

 in the old version I could use my data object stuff like:

 data x printString

No matter how I change my old code I do always get an error "nil does not understand #at:put:" or:
" ""someother class instance like HashedCollection"" does not understand #x"

How am I supposed to reimplement such thing for the new Amber version?

Thanks
Sebastian


Am 14.02.2013 07:43, schrieb Apostolis Xekoukoulotakis:
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <[hidden email]>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>
> Not _exactly_ (HashedCollection is deeper subclass, it is not wrapping
> plain JS Object), but it can be used in lots of places instead of plain
> object (jQuery options, css etc., all works).
>
>
>
>
>
>
>
> > 2013/2/14 Apostolis Xekoukoulotakis <[hidden email]
> > <mailto:[hidden email]>>
>
> >     The new interpreter doesnt allow to have both smalltalk and
> >     javascript code at the same method or workspace.
>
> >     2013/2/14 Tom <[hidden email] <mailto:[hidden email]>>
>
> >         Hi everybody,
>
> >         how comes, I cannot evaluate the following in the workspace...
>
> >         jsObj := <{}>.
>
> >         All I get is an alert() saying: "Parse error on line 1 column 17 :
> >         Unexpected character <"
>
> >         Any suggestions?
>
> >         --
> >         You received this message because you are subscribed to the
> >         Google Groups "amber-lang" group.
> >         To unsubscribe from this group and stop receiving emails from
> >         it, send an email to [hidden email]
> >         <mailto:[hidden email]>.
> >         For more options, visithttps://groups.google.com/groups/opt_out.
>
> >     --
>
> >     Sincerely yours,
>
> >           Apostolis Xekoukoulotakis
>
> > --
>
> > Sincerely yours,
>
> >       Apostolis Xekoukoulotakis
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "amber-lang" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [hidden email].
> > For more options, visithttps://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.





--

        
Sincerely yours, 
     Apostolis Xekoukoulotakis
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

Manfred Kröhnert

Hello Sebastian,

In the latest versions of Amber it is not possible to put inline js mixed with Smalltalk code in a single method.

What prevents you from using a collection in this case?

Best,
Manfred

Am 22.08.2013 23:26 schrieb "Sebastian Heidbrink" <[hidden email]>:
Hi,

 I just upgrade some older amber stuff of mine to the most current version.

I do have a problem with inlining and I do not know how to reimplement it in the current version.


    | data |
   <data = {}>.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

 in the old version I could use my data object stuff like:

 data x printString

No matter how I change my old code I do always get an error "nil does not understand #at:put:" or:
" ""someother class instance like HashedCollection"" does not understand #x"

How am I supposed to reimplement such thing for the new Amber version?

Thanks
Sebastian


Am 14.02.2013 07:43, schrieb Apostolis Xekoukoulotakis:
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <[hidden email]>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>
> Not _exactly_ (HashedCollection is deeper subclass, it is not wrapping
> plain JS Object), but it can be used in lots of places instead of plain
> object (jQuery options, css etc., all works).
>
>
>
>
>
>
>
> > 2013/2/14 Apostolis Xekoukoulotakis <[hidden email]
> > <mailto:[hidden email]>>
>
> >     The new interpreter doesnt allow to have both smalltalk and
> >     javascript code at the same method or workspace.
>
> >     2013/2/14 Tom <[hidden email] <mailto:[hidden email]>>
>
> >         Hi everybody,
>
> >         how comes, I cannot evaluate the following in the workspace...
>
> >         jsObj := <{}>.
>
> >         All I get is an alert() saying: "Parse error on line 1 column 17 :
> >         Unexpected character <"
>
> >         Any suggestions?
>
> >         --
> >         You received this message because you are subscribed to the
> >         Google Groups "amber-lang" group.
> >         To unsubscribe from this group and stop receiving emails from
> >         it, send an email to [hidden email]
> >         <mailto:[hidden email]>.
> >         For more options, visithttps://groups.google.com/groups/opt_out.
>
> >     --
>
> >     Sincerely yours,
>
> >           Apostolis Xekoukoulotakis
>
> > --
>
> > Sincerely yours,
>
> >       Apostolis Xekoukoulotakis
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "amber-lang" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [hidden email].
> > For more options, visithttps://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.





--

        
Sincerely yours, 
     Apostolis Xekoukoulotakis
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

laci
In reply to this post by Ankh'nAton
data := #{}.
Should do.

From: Manfred Kröhnert
Sent: 22/08/2013 23:30
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Hello Sebastian,

In the latest versions of Amber it is not possible to put inline js mixed with Smalltalk code in a single method.

What prevents you from using a collection in this case?

Best,
Manfred

Am 22.08.2013 23:26 schrieb "Sebastian Heidbrink" <[hidden email]>:
Hi,

 I just upgrade some older amber stuff of mine to the most current version.

I do have a problem with inlining and I do not know how to reimplement it in the current version.


    | data |
   <data = {}>.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

 in the old version I could use my data object stuff like:

 data x printString

No matter how I change my old code I do always get an error "nil does not understand #at:put:" or:
" ""someother class instance like HashedCollection"" does not understand #x"

How am I supposed to reimplement such thing for the new Amber version?

Thanks
Sebastian


Am 14.02.2013 07:43, schrieb Apostolis Xekoukoulotakis:
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <[hidden email]>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>

[The entire original message is not included.]

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

SebastianHC
Well, the problem is that when I do so, I get a
"a HashedCollection ('x' -> '1' , 'y' -> '2' , 'z' -> '3') does not understand x"
Error

data := #{}. was my first idea, too....

Sebastian


Am 22.08.2013 14:47, schrieb László Tordai:
data := #{}.
Should do.

From: Manfred Kröhnert
Sent: 22/08/2013 23:30
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Hello Sebastian,

In the latest versions of Amber it is not possible to put inline js mixed with Smalltalk code in a single method.

What prevents you from using a collection in this case?

Best,
Manfred

Am 22.08.2013 23:26 schrieb "Sebastian Heidbrink" <[hidden email]>:
Hi,

 I just upgrade some older amber stuff of mine to the most current version.

I do have a problem with inlining and I do not know how to reimplement it in the current version.


    | data |
   <data = {}>.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

 in the old version I could use my data object stuff like:

 data x printString

No matter how I change my old code I do always get an error "nil does not understand #at:put:" or:
" ""someother class instance like HashedCollection"" does not understand #x"

How am I supposed to reimplement such thing for the new Amber version?

Thanks
Sebastian


Am 14.02.2013 07:43, schrieb Apostolis Xekoukoulotakis:
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <[hidden email]>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

laci
In reply to this post by Ankh'nAton
I think you need to use dot as separated instead of comma. Comma is concatenation.

From: Sebastian Heidbrink
Sent: 22/08/2013 23:58
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Well, the problem is that when I do so, I get a
"a HashedCollection ('x' -> '1' , 'y' -> '2' , 'z' -> '3') does not understand x"
Error

data := #{}. was my first idea, too....

Sebastian


Am 22.08.2013 14:47, schrieb László Tordai:
data := #{}.
Should do.

From: Manfred Kröhnert
Sent: 22/08/2013 23:30
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Hello Sebastian,

In the latest versions of Amber it is not possible to put inline js mixed with Smalltalk code in a single method.

What prevents you from using a collection in this case?

Best,
Manfred

Am 22.08.2013 23:26 schrieb "Sebastian Heidbrink" <[hidden email]>:
Hi,

 I just upgrade some older amber stuff of mine to the most current version.

I do have a problem with inlining and I do not know how to reimplement it in the current version.


    | data |
   <data = {}>.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

 in the old version I could use my data object stuff like:

 data x printString

No matter how I change my old code I do always get an error "nil does not understand #at:put:" or:
" ""someother class instance like HashedCollection"" does not understand #x"

How am I supposed to reimplement such thing for the new Amber version?

Thanks
Sebastian


Am 14.02.2013 07:43, schrieb Apostolis Xekoukoulotakis:
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <[hidden email]>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to

[The entire original message is not included.]

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

SebastianHC
Oh,... I wrote that misleading.

That is the message I get in the debugger doing this:

| data |
   data := #{}.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

   data x printString

 with the old version and the "native object" <data = {}>. it worked very well.
 I do not really want to reimplement all the code that was implemented like that...

I guess JSProxyObject is not an option right?

Sebastian



Am 22.08.2013 15:05, schrieb László Tordai:
I think you need to use dot as separated instead of comma. Comma is concatenation.

From: Sebastian Heidbrink
Sent: 22/08/2013 23:58
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Well, the problem is that when I do so, I get a
"a HashedCollection ('x' -> '1' , 'y' -> '2' , 'z' -> '3') does not understand x"
Error

data := #{}. was my first idea, too....

Sebastian


Am 22.08.2013 14:47, schrieb László Tordai:
data := #{}.
Should do.

From: Manfred Kröhnert
Sent: 22/08/2013 23:30
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Hello Sebastian,

In the latest versions of Amber it is not possible to put inline js mixed with Smalltalk code in a single method.

What prevents you from using a collection in this case?

Best,
Manfred

Am 22.08.2013 23:26 schrieb "Sebastian Heidbrink" <[hidden email]>:
Hi,

 I just upgrade some older amber stuff of mine to the most current version.

I do have a problem with inlining and I do not know how to reimplement it in the current version.


    | data |
   <data = {}>.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

 in the old version I could use my data object stuff like:

 data x printString

No matter how I change my old code I do always get an error "nil does not understand #at:put:" or:
" ""someother class instance like HashedCollection"" does not understand #x"

How am I supposed to reimplement such thing for the new Amber version?

Thanks
Sebastian


Am 14.02.2013 07:43, schrieb Apostolis Xekoukoulotakis:
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <[hidden email]>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

SebastianHC
:-D

What about

    data := NativeFunction contructor: 'Object'.

Seems like that works...

Sebastian


Am 22.08.2013 15:13, schrieb Sebastian Heidbrink:
Oh,... I wrote that misleading.

That is the message I get in the debugger doing this:

| data |
   data := #{}.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

   data x printString

 with the old version and the "native object" <data = {}>. it worked very well.
 I do not really want to reimplement all the code that was implemented like that...

I guess JSProxyObject is not an option right?

Sebastian



Am 22.08.2013 15:05, schrieb László Tordai:
I think you need to use dot as separated instead of comma. Comma is concatenation.

From: Sebastian Heidbrink
Sent: 22/08/2013 23:58
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Well, the problem is that when I do so, I get a
"a HashedCollection ('x' -> '1' , 'y' -> '2' , 'z' -> '3') does not understand x"
Error

data := #{}. was my first idea, too....

Sebastian


Am 22.08.2013 14:47, schrieb László Tordai:
data := #{}.
Should do.

From: Manfred Kröhnert
Sent: 22/08/2013 23:30
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Hello Sebastian,

In the latest versions of Amber it is not possible to put inline js mixed with Smalltalk code in a single method.

What prevents you from using a collection in this case?

Best,
Manfred

Am 22.08.2013 23:26 schrieb "Sebastian Heidbrink" <[hidden email]>:
Hi,

 I just upgrade some older amber stuff of mine to the most current version.

I do have a problem with inlining and I do not know how to reimplement it in the current version.


    | data |
   <data = {}>.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

 in the old version I could use my data object stuff like:

 data x printString

No matter how I change my old code I do always get an error "nil does not understand #at:put:" or:
" ""someother class instance like HashedCollection"" does not understand #x"

How am I supposed to reimplement such thing for the new Amber version?

Thanks
Sebastian


Am 14.02.2013 07:43, schrieb Apostolis Xekoukoulotakis:
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <[hidden email]>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

matthias.springer
Hi,

just a short clarification. We are dealing with two types of dictionaries/objects here. 

Smalltalk/Amber dictionaries are instances of "HashedCollection" or "Dictionary". "#{...}" creates a Smalltalk Dictionary. You can access the value for a key with "dictionary at: key". "dictionary key" does not work, because there is no method key.

In JavaScript, every object can be seen as a dictionary. Every time we use a JavaScript object, Amber automatically wraps it inside a JSObjectProxy instance. If you send a method to the proxy that does not exist as a Smalltalk message of the proxy (e.g. "key"), the proxy forwards the message to the JavaScript object. It calls a method of the JavaScript object, if it exists, or returns a property with that name. That's why we can send "key" to a JavaScript dictionary. Your old code "<data = {};> created a JavaScript object and JSObjectProxy supports working with the object with "at:" and sending messages to it directly.

You should use HashedCollection objects if you're passing the objects to external JavaScript libraries, since Dictionary has a different internal layout.

In your case, you could create a subclass of HashedCollection/Dictionary and add this method (treat all unknown messages as dictionary lookup):

doesNotUnderstand: aMessage
^ self at: aMessage selector

Then create instances of your new subclass instead of "#{}". Or create a plain JavaScript object (and its proxy) with "NativeFunction".

Matthias

On Friday, August 23, 2013 12:43:19 AM UTC+2, HCSebastian wrote:
:-D

What about

    data := NativeFunction contructor: 'Object'.

Seems like that works...

Sebastian


Am 22.08.2013 15:13, schrieb Sebastian Heidbrink:
Oh,... I wrote that misleading.

That is the message I get in the debugger doing this:

| data |
   data := #{}.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

   data x printString

 with the old version and the "native object" <data = {}>. it worked very well.
 I do not really want to reimplement all the code that was implemented like that...

I guess JSProxyObject is not an option right?

Sebastian



Am 22.08.2013 15:05, schrieb László Tordai:
I think you need to use dot as separated instead of comma. Comma is concatenation.

From: Sebastian Heidbrink
Sent: 22/08/2013 23:58
To: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="IJR_uj6AD4gJ">amber...@...
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Well, the problem is that when I do so, I get a
"a HashedCollection ('x' -> '1' , 'y' -> '2' , 'z' -> '3') does not understand x"
Error

data := #{}. was my first idea, too....

Sebastian


Am 22.08.2013 14:47, schrieb László Tordai:
data := #{}.
Should do.

From: Manfred Kröhnert
Sent: 22/08/2013 23:30
To: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="IJR_uj6AD4gJ">amber...@...
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Hello Sebastian,

In the latest versions of Amber it is not possible to put inline js mixed with Smalltalk code in a single method.

What prevents you from using a collection in this case?

Best,
Manfred

Am 22.08.2013 23:26 schrieb "Sebastian Heidbrink" <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="IJR_uj6AD4gJ">sebastian...@...>:
Hi,

 I just upgrade some older amber stuff of mine to the most current version.

I do have a problem with inlining and I do not know how to reimplement it in the current version.


    | data |
   <data = {}>.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

 in the old version I could use my data object stuff like:

 data x printString

No matter how I change my old code I do always get an error "nil does not understand #at:put:" or:
" ""someother class instance like HashedCollection"" does not understand #x"

How am I supposed to reimplement such thing for the new Amber version?

Thanks
Sebastian


Am 14.02.2013 07:43, schrieb Apostolis Xekoukoulotakis:
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="IJR_uj6AD4gJ">t...@...>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="IJR_uj6AD4gJ">amber-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="IJR_uj6AD4gJ">amber-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Initializing a new JavaScript object

Nicolas Petton
In reply to this post by SebastianHC
If you really need an empty JS object from Amber, I would put that into a separate method:

emptyData
<return {};>

then use it as you did in the past.

HTH,
nico

On Aug 23, 2013, at 12:43 AM, Sebastian Heidbrink <[hidden email]> wrote:

:-D

What about

    data := NativeFunction contructor: 'Object'.

Seems like that works...

Sebastian


Am 22.08.2013 15:13, schrieb Sebastian Heidbrink:
Oh,... I wrote that misleading.

That is the message I get in the debugger doing this:

| data |
   data := #{}.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

   data x printString

 with the old version and the "native object" <data = {}>. it worked very well.
 I do not really want to reimplement all the code that was implemented like that...

I guess JSProxyObject is not an option right?

Sebastian



Am 22.08.2013 15:05, schrieb László Tordai:
I think you need to use dot as separated instead of comma. Comma is concatenation.

From: Sebastian Heidbrink
Sent: 22/08/2013 23:58
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Well, the problem is that when I do so, I get a
"a HashedCollection ('x' -> '1' , 'y' -> '2' , 'z' -> '3') does not understand x"
Error

data := #{}. was my first idea, too....

Sebastian


Am 22.08.2013 14:47, schrieb László Tordai:
data := #{}.
Should do.

From: Manfred Kröhnert
Sent: 22/08/2013 23:30
To: [hidden email]
Subject: Re: [amber-lang] Re: Initializing a new JavaScript object

Hello Sebastian,

In the latest versions of Amber it is not possible to put inline js mixed with Smalltalk code in a single method.

What prevents you from using a collection in this case?

Best,
Manfred

Am 22.08.2013 23:26 schrieb "Sebastian Heidbrink" <[hidden email]>:
Hi,

 I just upgrade some older amber stuff of mine to the most current version.

I do have a problem with inlining and I do not know how to reimplement it in the current version.


    | data |
   <data = {}>.
  data at: 'x' put: ('.x input') asJQuery val.
  data at: 'y' put: ('.y input') asJQuery val.
  data at: 'z' put: ('.z input') asJQuery val.

 in the old version I could use my data object stuff like:

 data x printString

No matter how I change my old code I do always get an error "nil does not understand #at:put:" or:
" ""someother class instance like HashedCollection"" does not understand #x"

How am I supposed to reimplement such thing for the new Amber version?

Thanks
Sebastian


Am 14.02.2013 07:43, schrieb Apostolis Xekoukoulotakis:
Ok. Inspecting on both objects though gives a HashedCollection so maybe inspection is not accurate enough.

|jsObj|
jsObj := #{ 'x'->23. 'y'->42 }.
jsObj:=HashedCollection new.
jsObj at:'x' put:23.
jsObj at:'y' put:42;yourself.



2013/2/14 Tom <[hidden email]>
Thanxalot :)

I should have mentioned earlier. I am looking for a way to copy/paste
some JSON Arrays into Smalltalk objects.

On 14 Feb., 16:25, Herby Vojčík <[hidden email]> wrote:
> Apostolis Xekoukoulotakis wrote:
> > Use a HashedCollection object instead. I think it is exactly the same.
>

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to

[The entire original message is not included.]
--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
12