How do I intercept a property set on a custom common object

35 views
Skip to first unread message

Paul Tyng

unread,
Jan 6, 2012, 4:43:45 PM1/6/12
to IronJS
Is there anyway to handle a property set on a custom CommonObject
implementation?

I tried overriding Put but that didn't seem to work.

Basically if the code has something like:

object.value = 'some string';

Where object is an instance of my own custom CommonObject
implementation, I want to handle that property set to do additional
special processing.

Thanks for any help you can provide.

Paul

Paul T

unread,
Jan 9, 2012, 10:55:41 AM1/9/12
to IronJS
I found a similar question unanswered on stackoverflow, so if you have
the answer for this feel free to cross post over there for some
reputation:

http://stackoverflow.com/questions/7534413/ironjs-commonobject-are-dynamic-properties-possible

John Gietzen

unread,
Jan 9, 2012, 11:51:14 AM1/9/12
to Paul T, IronJS
I'm currently in the process of relocating to Seattle, but I'll take a
look as soon as I can.

Sent from my Windows Phone
From: Paul T
Sent: 1/9/2012 9:55 AM
To: IronJS
Subject: [IronJS:47] Re: How do I intercept a property set on a custom
common object

Paul T

unread,
Jan 9, 2012, 5:00:30 PM1/9/12
to IronJS
Thanks.  I was hoping for a simple solution, but I was looking through
the F# (my understanding is limited) and it seems like for property
access goes through a different flow than function invocation.  When
accessing a property similar to:

test.abc

I see 2 hits to the InlineCache, one for 'test' and one for 'abc'.

But if executing:

test.abc()

I only see one hit to the InlineCache for 'abc' and then it hits the
CommonObject's implementation of Get(name) which finds the
FunctionObject instance.

So it seems like the property access and function invocation are
compiling to differing ways of accessing the object.

I would love to contribute but I'm trying to pick up the F# as I go so
its a bit slow currently and I can't really unwind it yet in my head,
but will let you know if I made any progress on my fork.

On Jan 9, 11:51 am, John Gietzen <spoonfuloftac...@gmail.com> wrote:
> I'm currently in the process of relocating to Seattle, but I'll take a
> look as soon as I can.
>
> Sent from my Windows Phone
> From: Paul T
> Sent: 1/9/2012 9:55 AM
> To: IronJS
> Subject: [IronJS:47] Re: How do I intercept a property set on a custom
> common object
> I found a similar question unanswered on stackoverflow, so if you have
> the answer for this feel free to cross post over there for some
> reputation:
>
> http://stackoverflow.com/questions/7534413/ironjs-commonobject-are-dy...
Reply all
Reply to author
Forward
0 new messages