jbcoe / jbcoe/mylang

Design proposal: add a dynamic type

Open
#84 5 comments 0 reactions 2 assignees Claimed by @ajbennieston View on GitHub
design proposal
Dominant language
Rust
Stars
3
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Should we add support for dictionary/table like types to `mylang` making it very dynamic

https://www.lua.org/pil/2.5.html
https://www.lua.org/pil/11.1.html

If not we probably want static typing and need a plan for extra types we'll need.

Maybe we could do both and have a dynamic_table (`dyn_table`) type that bypasses the type checker as its entries can change at runtime. This could be interesting as it's the opposite design decision taken by Python (+mypy type checking) where everything is untyped (Any) by default.

https://mypy.readthedocs.io/en/stable/kinds_of_types.html#the-any-type

Possible syntax for dynamic tables:

```
let mut a = dynamic; #new keyword, do we want `dyn` instead? Do we need `mut`?
let a.0 = 5;
let mut a.1 = "Hi";
let a.key = fn (a, b) { return a; };
let a["key with space"] = 3.14159;

a.1 = "Bye";
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.