Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
Overview of Edelweiss, talk slides (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
petar committed May 19, 2022
1 parent 6afa5a7 commit ab209f6
Show file tree
Hide file tree
Showing 3 changed files with 367 additions and 37 deletions.
74 changes: 37 additions & 37 deletions doc/manual-milestone1-slides/manual-milestone1-slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ Named{
# Significance of types

1. Semantics of data (agnostic to programming language)
2. Representation of data in IPLD Data Model (encoding/decoding)
2. Representation of data in the IPLD Data Model (encoding/decoding)
Note: _"Transforms" (introduced later) can alter representation._
3. Representation of data in user's programming language
3. Representation of data in the target programming language

---
# Types
Expand Down Expand Up @@ -170,39 +170,39 @@ type Byte byte
---
# Char

Semantically:
**Semantically:**
- a character is not an integer

Representationally:
**Representationally:**
- encoded as an IPLD integer which is a valid UTF8

Programmatically:
**Programmatically:**
- Implemented by `type Char rune` in package `edelweiss/values`

---
# String

Semantically:
**Semantically:**
- `String{}` is equivalent to `List{Element: Char{}}`

Representationally:
**Representationally:**
- Encodes to IPLD string
- Decodes from a UTF8 IPLD string or the IPLD encoding of `List{Element: Char{}}`

Programmatically:
**Programmatically:**
- Implemented by `type String string` in package `edelweiss/values`

---
# Bytes

Semantically:
**Semantically:**
- `Bytes{}` is equivalent to `List{Element: Byte{}}`

Representationally:
**Representationally:**
- Encodes to IPLD bytes
- Decodes from IPLD bytes or the IPLD encoding of `List{Element: Byte{}}`

Programmatically:
**Programmatically:**
- Implemented by `type Bytes []byte` in package `edelweiss/values`

---
Expand All @@ -211,13 +211,13 @@ Programmatically:
---
# Nothing

Semantically:
**Semantically:**
- `Nothing{}` holds no value

Representationally:
**Representationally:**
- Encodes as IPLD nothing

Programmatically:
**Programmatically:**
- Implemented by `type Nothing struct{}`

E.g. use in conjunction with `Inductive` types to describe enumerations.
Expand All @@ -226,7 +226,7 @@ E.g. use in conjunction with `Union` types to describe optional values.
---
# Any

Semantically:
**Semantically:**
- `Any{}` can hold any IPLD value
- IPLD kinds are in one-to-one mapping with types in this type sytem:
- IPLD bool, int, float, string, bytes map to `Bool{}`, `Int{}`, `Float{}`, `String{}`, `Bytes{}`
Expand All @@ -235,7 +235,7 @@ Semantically:
- IPLD map maps to `Map{Key: Any{}, Value: Any{}}`
- IPLD nothing maps to `Nothing{}`

Programmatically:
**Programmatically:**
- Implemented by `type Any struct{ Value }` where `Value` is an interface

---
Expand All @@ -244,45 +244,45 @@ Programmatically:
---
# Link

Semantically:
**Semantically:**
- `Link{To: TYPE_DEF_OR_REF}`

Representationally:
**Representationally:**
- Encodes as IPLD link

Programmatically:
**Programmatically:**
- Code-generated Go `struct` which holds a `Cid`

Use `Link{To: Any{}}` when the link target is of unknown type.

---
# List

Semantically:
**Semantically:**
- `List{Element: TYPE_DEF_OR_REF}`

Representationally:
**Representationally:**
- Encodes as IPLD list

Programmatically:
**Programmatically:**
- Code-generated Go alias for a slice type

---
# Map

Semantically:
**Semantically:**
- `Map{Key: TYPE_DEF_OR_REF, Value: TYPE_DEF_OR_REF}`

Representationally:
**Representationally:**
- Encodes as IPLD list of key/value pairs or an IPLD map, if the key is a string

Programmatically:
**Programmatically:**
- Code-generated Go slice of key/value pairs or a Go map, if the key is a string

---
# Structure

Semantically:
**Semantically:**
- A list of named and typed fields, written as
```go
Structure{
Expand All @@ -293,16 +293,16 @@ Structure{
}
```

Representationally:
**Representationally:**
- Encodes as IPLD map

Programmatically:
**Programmatically:**
- Code-generated Go `struct`

---
# Singletons

Semantically:
**Semantically:**
- A builtin value that always equals a given constant, written as
```go
SingletonBool{BOOL_VALUE}
Expand All @@ -313,16 +313,16 @@ SingletonFloat{FLOAT_VALUE}
SingletonString{STRING_VALUE}
```

Representationally:
**Representationally:**
- Encoded as the correspoding IPLD kind

Programmatically:
**Programmatically:**
- Code-generated as an empty Go `struct`

---
# Inductive

Semantically:
**Semantically:**
- One of a list of name/value pairs _distinguished by their name_, written as
```go
Inductive{
Expand All @@ -333,18 +333,18 @@ Inductive{
}
```

Representationally:
**Representationally:**
- Encoded as an IPLD map, wrapping the case name and its value

Programmatically:
**Programmatically:**
- Code-generated as a Go `struct` with one pointer field per case

_"Inductive" types correspond to IPLD Schema "union" types._

---
# Union

Semantically:
**Semantically:**
- One of a list of name/value pairs _distinguished by their value_, written as
```go
Union{
Expand All @@ -355,11 +355,11 @@ Union{
}
```

Representationally:
**Representationally:**
- Encoded as the value of the active case
- The union itself has _no representational footprint_

Programmatically:
**Programmatically:**
- Code-generated as a Go `struct` with one pointer field per case

---
Expand Down
Loading

0 comments on commit ab209f6

Please sign in to comment.