Comparison of python vs golang # method and polymorphism # in use

1, # method # comparison of the use of two languages 1.1 python: Because python supports object-oriented programming, we can first define classes, bind attributes (data) in classes, and then use data encapsulation (define functions to access data), that is, class methods. Finally, the use of the method is realized after instantiation. Define ...

Added by Cypher87 on Sat, 18 Dec 2021 08:55:53 +0200

Understand the interpreter mode

principle Define grammar rules for the new "language" and define an interpreter to interpret grammar Implementation core Split the operations of different operators into separate operator expression classes to avoid large and complete parsing classes Best Practices 1 Demand background Suppose we define a new "language" ...

Added by dc2_jspec on Sat, 18 Dec 2021 04:05:41 +0200

Problems and solutions encountered in the use of polling lock!

When we encounter a deadlock, we can not only manually restart the program to solve it, but also consider using sequence lock and polling lock. For this part, please refer to my previous article, which will not be repeated here. However, improper use of polling lock will bring new serious problems, so in this article, we will learn about these ...

Added by SwiftlyTilting on Sat, 18 Dec 2021 03:23:42 +0200

Summary of the use of go kit microservice framework -- Practice of service registration and discovery

Go microservice framework practice Go kit framework Start service registration and Discovery Center The consul used by the service registration and discovery center can be downloaded from the official website https://www.consul.io/docs/agent Consul of the corresponding system. windows case: After downloading and installing, it is an ex ...

Added by Bman900 on Sat, 18 Dec 2021 02:35:05 +0200

Getting started with Golang - Reflection package

Reflection of methods and types When reflecting, use the program to check its own structure. Yes meta-programming A form of. Reflection can check types and variables at run time. Unless it is really necessary, it should be avoided or used with care. Two simple functions in the reflection package: reflect. Typeof (I interface {}): returns ...

Added by jcm93 on Sat, 18 Dec 2021 01:15:37 +0200

Go language Map basic principle entry level

Map underlying principle map is a data structure used to store a series of unordered key value pairs, which are stored based on keys, so that we can quickly find the corresponding values through keys. Introduction to internal implementation The bottom layer of Go is a Hash list. The Hash list contains a group of pokes. When storing, deleting ...

Added by joozt on Fri, 17 Dec 2021 12:44:36 +0200

glang context end - source code analysis

summary The context package is golang1 6 start to provide the context package, golang1 7 move into the standard library. Context is only used in grpc, but it is not really used in its own program, and it does not understand its purpose. You must end with the context. Main role It mainly solves the problem that multiple goroutines and multipl ...

Added by clairence on Fri, 17 Dec 2021 06:22:54 +0200

Go1.18 version generic details

1. Introduction to generics Today is December 16, 2021. The day before yesterday, that is, on the 14th, Golang officially released go1 In the Beta version of 18, the heaviest update is generics What are generics? Some small partners may not know the concept. In fact, generics are products equivalent to templates in C + + For example: vector ...

Added by gladiator83x on Thu, 16 Dec 2021 19:26:43 +0200

gRPC: Quickly configure generic API to get process meta-information

introduceThis article describes how to quickly configure a common API through rk-boot and obtain process meta-information.What is process meta-information?The process meta-information contains the following:NamedetailsAPI ListGet API ListgRPC Error InformationgRPC corresponds to grpc-gateway error informationOS InformationCurrent OS Information ...

Added by ddevitt on Wed, 15 Dec 2021 23:37:29 +0200

The Golang gRPC practice uses FlatBuffers encoding in gRPC

introducegRPC uses Protocol Buffers by default, and supports other codes, such as JSON and FlatBuffers.FlatBuffers is a cross platform serialization library designed to achieve maximum memory efficiency. It allows you to directly access serialized data without first parsing / unpacking it, while still having good forward / backward compatibilit ...

Added by webwannabee on Wed, 15 Dec 2021 19:41:12 +0200