updates
This commit is contained in:
parent
4d2f3ef860
commit
8e62f7175c
5 changed files with 78 additions and 0 deletions
8
20200807173133-decentralized_social_networks.org
Normal file
8
20200807173133-decentralized_social_networks.org
Normal file
|
@ -0,0 +1,8 @@
|
|||
#+title: Decentralized social networks
|
||||
* Secure Scuttlebutt (SSB)
|
||||
- https://en.wikipedia.org/wiki/Secure_Scuttlebutt
|
||||
- https://scuttlebutt.nz/
|
||||
- https://www.manyver.se/
|
||||
- https://github.com/fraction/oasis
|
||||
|
||||
How do these differ from services like Diaspora or Mastodon?
|
25
20201007142751-python_typing.org
Normal file
25
20201007142751-python_typing.org
Normal file
|
@ -0,0 +1,25 @@
|
|||
#+title: Python Typing
|
||||
|
||||
Python does not require nor enforce strict typing, and instead takes a dynamic
|
||||
approach using [[file:20201008164244-duck_typing.org][Duck Typing]].
|
||||
|
||||
Optional [[file:20201008164835-structural_typing.org][Structural Typing]] support for Python is provided via type hints as
|
||||
described in [[https://www.python.org/dev/peps/pep-0484/][PEP-484]].
|
||||
|
||||
Variables, function arguments, and return values can have their types annotated,
|
||||
e.g. "variable x has type integer" or "function y takes a string and returns a
|
||||
list of dictionaries". While these are optional and not checked at run-time,
|
||||
they serve as documentation and can be used by various type checkers to ensure
|
||||
program correctness.
|
||||
|
||||
* Available Type Checkers
|
||||
- Mypy :: http://mypy-lang.org/
|
||||
- Pyright (Microsoft) :: https://github.com/Microsoft/pyright
|
||||
- Pyre (Facebook) :: https://pyre-check.org/
|
||||
- Pytype (Google) :: https://google.github.io/pytype/
|
||||
|
||||
* Limitations
|
||||
- Type hints do not guarantee purity.
|
||||
- Type hints are not checked at run-time.
|
||||
* Fun facts
|
||||
- Python's =boolean= inherits from =int=, hence =True + True = 2=.
|
15
20201008164244-duck_typing.org
Normal file
15
20201008164244-duck_typing.org
Normal file
|
@ -0,0 +1,15 @@
|
|||
#+title: Duck Typing
|
||||
|
||||
#+begin_quote
|
||||
Duck typing in computer programming is an application of the duck test—"If it
|
||||
walks like a duck and it quacks like a duck, then it must be a duck"—to
|
||||
determine if an object can be used for a particular purpose. With normal typing,
|
||||
suitability is determined by an object's type. In duck typing, an object's
|
||||
suitability is determined by the presence of certain methods and properties,
|
||||
rather than the type of the object itself.
|
||||
|
||||
--- https://en.wikipedia.org/wiki/Duck_typing
|
||||
#+end_quote
|
||||
|
||||
This contrasts with [[file:20201008164835-structural_typing.org][Structural Typing]], where the type of the object itself is
|
||||
used to determine its suitability.
|
19
20201008164835-structural_typing.org
Normal file
19
20201008164835-structural_typing.org
Normal file
|
@ -0,0 +1,19 @@
|
|||
#+title: Structural Typing
|
||||
|
||||
#+begin_quote
|
||||
A structural type system (or property-based type system) is a major class of
|
||||
[[file:20201008164956-type_system.org][Type System]] in which type compatibility and equivalence are determined by the
|
||||
type's actual structure or definition and not by other characteristics such as
|
||||
its name or place of declaration. Structural systems are used to determine if
|
||||
types are equivalent and whether a type is a subtype of another.
|
||||
|
||||
--- https://en.wikipedia.org/wiki/Structural_type_system
|
||||
#+end_quote
|
||||
|
||||
* Benefits
|
||||
** Easier reasoning
|
||||
Types make it easier to reason about code, as they describe succinctly what a
|
||||
function can do. If a function takes a single string as an argument and returns an integer, there's only so many things
|
||||
** Error reduction
|
||||
While types are not a substitute for testing, they do obviate a class of tests
|
||||
that you have to write yourself.
|
11
20201008164956-type_system.org
Normal file
11
20201008164956-type_system.org
Normal file
|
@ -0,0 +1,11 @@
|
|||
#+title: Type System
|
||||
|
||||
Used in [[file:20200723095845-software_development.org][Software Development]].
|
||||
|
||||
#+begin_quote
|
||||
In programming languages, a type system is a logical system comprising a set of
|
||||
rules that assigns a property called a type to the various constructs of a
|
||||
computer program, such as variables, expressions, functions or modules.
|
||||
|
||||
--- https://en.wikipedia.org/wiki/Type_system
|
||||
#+end_quote
|
Loading…
Reference in a new issue