Tag:Memory address

  • Details of this


    Definition of this: represents the environment object of the current execution code Therefore, the analysis of this can be divided into “global environment” and “function environment” 1、 Global environment console.log(this === window); // true var a = 10; console.log(this.a); // 10 2、 Function environment Inside the function, the value of this depends on the running environment when the function is […]

  • Vue implements deep copy assignment on data objects


    In the daily Vue development work, we often assign variables to the requested data, and then use variables to render the data. However, we know that the assignment method we often use “=” is actually a shallow copy of the data, that is, when you change the assignment variable, the original data will change accordingly. […]

  • The implementation principle of Python dictionary


    The implementation principle of Python dictionary Pseudo code a = {} a[‘key1’] = 1 a[‘key2’] = 6 del a [‘key1’] Underlying implementation Python interpreter executes a = {}Python interpreter read here, for example, will give five consecutive memory space, there are five consecutive memory addresses, can put data The Python interpreter executes a [‘key1 ‘] […]

  • Go trap for loop iteration variable


    Reprinted from the originalGo trap for loop iteration variable Capture iteration variables It’s learningGo programmingIt’s an important warning that I encountered in the project. This is a trap of the go language’s lexical scope rules. After watching it, I feel that it’s really a confusing place. So make a special record. You can see from […]

  • C # span source code interpretation and application practice


    1: Background 1. Tell a story I’m so busy at work these two days that I didn’t produce any articles in time. I’m sorry. A friend in the group asked when I could produce the next article of span a few days ago. Ha ha, here it comes! Friends who have read the last article […]

  • Realization of monitoring index in libp2p RS


    Module address:https://github.com/netwarps/l… Libp2p RS as a P2P network project, sometimes we may need to observe the sending and receiving of network data, and collect and summarize it. Based on this premise, a metric module is designed to implement the related content. Conception of metric implementation Libp2p supports connecting multiple peers, and each peer supports different […]

  • Data in Vue is a function, not an object


    In a project, there can be multiple components. Each component can be used as a constructor. The essence of registering a component is actually a reference of the constructor.If you use objects directly, their memory addresses are the same. If one data is changed, the others are changed, which will cause data pollution,If a function […]

  • [2020python practice 18] Introduction to Python syntax – function object + function nesting + closure function


      catalog 1. Function object 2. Function nesting 3. Closure function 3.1 what is a closure function 3.2 how to define closure function 3.3 why there is a closure function — application scenarios of closure functions   1. Function object Function object: function can be treated as data. #Func = memory address def func(): Print […]

  • Go language slice


    section brief introduction In short, slicing is a simplified version of a dynamic array. The length of go array cannot be changed, and the length of slice is not fixed, so the length of slice cannot be a part of type. Although arrays have their own applications, the types and operations of arrays are not […]

  • After years of development framework, do you still know the pointer?


    1: Background 1. Tell a story If you play with high-level language a lot, maybe many people forget about pointer or assembly. This article will talk about pointer. Although C ා is not advocated, can you say that pointer is not important in C ා? You should know that there are a lot of pointers […]

  • Research on deep copy / shallow copy of nsarray and nsmutablearray


    1、 Yuanqi The following two questions should be asked frequently during the interview. YesNSArrayandNSMutableArrayconductcopyandmutableCopyWhat kind of arrays do you get? WhenNSStringAs a property of an object, we should usestrongstillcopyTo decorate? During the interview in March this year, I was confused by these two questions, so I specially studied them today.I believe that you will have […]

  • Do you really understand the const command in JS?


    We all know that const generally declares a read-only constant, which cannot be modified after declaration, and must be initialized const message = ‘hello’ message // hello const message // A kind of Syntax error: missing initializer in const declaration const message = ‘hello’ message =’world’ // A kind of Type error: assignment to constant […]