How to treat this?

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

How to treat this?

NorbertHartl
I have the impression this might be a dumb question but…

What role does "this" play in amber? And how can I access it? I'm trying to parse a JSON string and use the

JSON.parse( string, reviver)

So I can do

JSON parse: '{ "a" : { "b" : "c" }}' with: [ :key :value | 
Transcript show: '* '; show: key; show: ' -> '; show: value; cr ]

The parse is a depth-first traversal and the current object that is parsed seems to be accessible via "this". So I would need acess to it in order to be able to nest properly. 

Norbert

--
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/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to treat this?

Herby Vojčík
Accessing 'this' in blocks is done via currySelf message sent to a block to transform it so it gets this as the first parameter. Inside method, of course self is 'this'.


Dňa 17. februára 2015 11:41:19 CET používateľ Norbert Hartl <[hidden email]> napísal:
I have the impression this might be a dumb question but…

What role does "this" play in amber? And how can I access it? I'm trying to parse a JSON string and use the

JSON.parse( string, reviver)

So I can do

JSON parse: '{ "a" : { "b" : "c" }}' with: [ :key :value | 
Transcript show: '* '; show: key; show: ' -> '; show: value; cr ]

The parse is a depth-first traversal and the current object that is parsed seems to be accessible via "this". So I would need acess to it in order to be able to nest properly. 

Norbert

--
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/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to treat this?

NorbertHartl
Thanks Herby!

Norbert

Am 17.02.2015 um 11:57 schrieb Herby Vojčík <[hidden email]>:

Accessing 'this' in blocks is done via currySelf message sent to a block to transform it so it gets this as the first parameter. Inside method, of course self is 'this'.


Dňa 17. februára 2015 11:41:19 CET používateľ Norbert Hartl <[hidden email]> napísal:
I have the impression this might be a dumb question but…

What role does "this" play in amber? And how can I access it? I'm trying to parse a JSON string and use the

JSON.parse( string, reviver)

So I can do

JSON parse: '{ "a" : { "b" : "c" }}' with: [ :key :value | 
Transcript show: '* '; show: key; show: ' -> '; show: value; cr ]

The parse is a depth-first traversal and the current object that is parsed seems to be accessible via "this". So I would need acess to it in order to be able to nest properly. 

Norbert



--
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/d/optout.

--
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/d/optout.