Tag:generic paradigm

  • Conditional types of typescript

    Time:2022-5-1

    preface The official documents of typescript have long been updated, but the Chinese documents I can find are still in the older version. Therefore, some newly added and revised chapters are translated and sorted out. This article is compiled from “typescript Handbook”Conditional Types“Chapter. This article is not translated strictly according to the original text, and […]

  • C# (VI) Fundamentals – arrays

    Time:2022-5-1

    C# This essay is for personal review and consolidation of knowledge. It is mostly summarized and understood from the book. If there are mistakes, please correct them   Data is simply a container that stores a series of data of the same type in order. The value type in the array defaults to 0, and […]

  • Introduction to golang generics

    Time:2022-4-30

    What is generics First of all, what is generics? Generics is actually a very broad concept. Generics in this paper refers to generics in computer programming language, that is, functions, methods and class definitions in programming language are independent of specific type parameters. The instantiation of related functions, methods and classes is based on specific […]

  • Gopher to rust hot eye grammar ranking

    Time:2022-4-27

    Gopher to rust hot eye grammar ranking Author: Zhongyi – sealos author, sealer initiator Top 10 often forget to write semicolons fn add_with_extra(x: i32, y: i32) -> i32 { let x = x + 1; // sentence let y = y + 5; // sentence X + Y // expression } When you first turn […]

  • Introduction to typescript mixins

    Time:2022-4-27

    Mixins In addition to the traditional OO hierarchy, another popular way to build classes from reusable components is to build them by combining simpler partial classes. You may be familiar with the idea of mixins or features in languages such as Scala, and this pattern is also popular in the JavaScript community. The pattern relies […]

  • Go generic tutorial

    Time:2022-4-26

    generic paradigm original textOnline reading Reading Guide: constraint usage method Implementation principle Compare with generics in other languages Using examples to learn generics issues Generics need to meetgo1.18+ constraint Go uses the interface as a constraint, which means to restrict the actual types of this generic type. Therefore, it can be understood that go extends […]

  • How effective is the method of creating string

    Time:2022-4-23

    After creation, the length content is immutable. Each time a string is spliced, a new object will be generated. If it is generated directly by “” or string constant splicing, it will be saved in the string constant pool. If it is created directly by new,Star pool ECSSave in heap. Advantages: the string class provides […]

  • Generic extension

    Time:2022-4-12

    Basic essential knowledge Union type vs cross type //Union type interface Bird { name: string; fly(): void;} interface Person { name: string; talk(): void;} type BirdPerson = Bird | Person; let p: BirdPerson = { name: “zfeng”, fly() {} }; let p1: BirdPerson = { name: “zfeng”, talk() {} }; The union type uses “|” […]

  • How does spring automatically inject multiple types

    Time:2022-4-11

    There is often a small problem around me. How does spring load field characters? Why does spring support so many types such as collection, list, map, string and so on? Are there any tips worth learning in the process of spring injection? With this doubt, let’s explore it. This article is based on springboot v2 […]

  • Arrays of scala data structures and algorithms

    Time:2022-4-9

    Array – fixed length array (declaring generics)The first way is to define an arrayexplain The array here is equivalent to the array in Java,Big data trainingThe type of brackets is the type of array val arrar1 = new arrayInt //Assignment, set elements are accessed in parentheses arr1(1) =7 Code demonstration package com.ldc object ArrayDemo01 { […]

  • Functional components and class components

    Time:2022-4-4

    There is no difference in use, but there is a slight difference in creationRobot functional components: import React from “react”; import styles from “./robot.module.css” interface RobotProps { id: number; name: string; email: string; } //Robot is defined as a function component and a generic type, which can be written as {props}. Propt is used to […]

  • Understand covariance and inversion in c# generic interfaces

    Time:2022-4-3

    Recently, I read the book c# advanced programming (Ninth Edition) and saw the chapter of generic interface. I didn’t quite understand about covariance and inversion. I talked a little bit. I checked a lot of information on the Internet and finally got it (feeling) clear. Come here to record it. 1、 What are covariance and […]