Hi,

I am trying to update Pyjs to implement id() because I cannot find a way to 
go around. Following is the code to insert in pyjs/builtin/pyjslib.py:

def id(obj):

    JS("""

        if(typeof @{{obj}}=='object' && @{{obj}}.id){
            return @{{obj}}.id;
        }else{
            return obj;    // if not an object, use obj itself as id
        }

    """)


But, Pyjs doesn't recognize this function when running.  I found that every 
built-in function had two different implementations (in pyjslib.py and 
_builtin__.py):

# in pyjslib.py:

 def chr(x):
    JS("""
        return String['fromCharCode'](@{{x}});
    """)


          # in _builtin__.py

def chr(x):
    JS("""
    return B$str(String.fromCharCode(@{{x}}.valueOf()));
    """)


Why are there two different implementations? I tried to insert the code for 
id() to both files, but none of them worked. What do I need to do to 
implement a built-in function?

Thanks.

-- 

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

Reply via email to