This is most likely related to 

https://groups.google.com/d/msg/clojurescript/bSFK6CEE3PE/nIoD11yjK_YJ


I have a situation where I need to run some code in a separate frame. I have to 
do this because some of the (external) code I use takes control of the page in 
a way I don't want - but does work I do want. I own the frame so I can call 
functions directly from the parent there.

The same js code is loaded in to the parent and frame (can cache the file).

A problem that I have run into is that keyword equality is no longer preserved 
with data passed across the frame boundary. I expect because of the deftype and 
some underlying comparison on objects from different contexts. (I looked at the 
data in the keyword objects and they appear the same).

The issue really comes out in map lookups which obviously return nil.

I can think of a few solutions to this but am looking for any input.

Options:
1. don't use keywords in cross frame data. somewhat limiting and impacts data 
produced by libraries.

2. encode in the parent (e.g. transit) and decode in the frame. This works but 
incurs overhead just for keyword translation - that will increase with data 
size. (interestingly transit will throw an error if you try to encode or decode 
data from another frame - I got "error can't write").

3. figure out a way to effectively execute  code from the parent only (ensuring 
all keywords are from the same source) - maybe possible - but I think this can 
cause trouble with DOM element creation in some cases - I ran into something 
here a long time ago. It may also mean that the working environment/context of 
the code is possibly harder to manage/reason about.

4. fix in cljs - but would probably result in slower general keyword 
comparison. (this may not be a generally applied thing - but might be a 
compiler option - for those special cases).


If js workers ever allow passing of objects and not only strings - this might 
impact there also.

Any thoughts welcome.

Thanks

Dave

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to