• I would expect that each name be different, should the attribute be specific to a function.

    I don't think you're understanding - \xFFcod is basically a field inside the function object. So every function has its own one. The choice of string/flatstring depends on what was seemed most efficient to Espruino when it was defined.


    Again, I don't think you really took in what I said previously. You just defined a String with contents history and you're outputting that, not what was called history.

    If you want history, you look at:

    #1[r2,l1] Object {
      #2[r1,l2] Name String [1 blocks] "\xFF"    #3[r1,l1] Object {
          #6[r1,l2] Name String [2 blocks] "timers"        #8[r2,l0] Array(0) [ ]
          #9[r1,l2] Name String [2 blocks] "watches"        #11[r2,l0] Array(0) [ ]
          #15[r1,l2] Name String [2 blocks] "history"        #19[r1,l0] Array(54) [

    And go back down the trace output, using the name in the lines above:


    for (let [key, value] of Object.entries(aaa)) {

    Espruino doesn't support that syntax.

    global.forEach(element => console.log(element));

    A few lines earlier you did typeof global and found it was an object. Objects don't have forEach.

    Object.keys(global).forEach(name=> ...); is fine though

    As typeof trace() returns ="undefined" I'm starting to wonder if it is in fact just a function that prints to the console

    Yes, it prints.

    a small sample to get going would be appreciated.

    Ok, so there's what I mentioned above with history.

    So let's say you're after 637... I've copied your trace contents below, but have removed any lines of the same indenting to make it clearer.

    #1[r2,l1] Object {
      #428[r1,l2] Name String [1 blocks] "dl"    #438[r1,l0] Function {
          #437[r1,l2] Name String [1 blocks] "\xFFcod"        #637[r1,l0] FlatString [150 blocks] "

    So now, you just work back. You can see \xffcod then dl then you're back at the global object, so:


Avatar for Gordon @Gordon started