4 ms·
Fewer types: Values are at the center of your computations. Only a handful of predefined types of values exist: 3 # int "Candy"
by karmakaze 3y ago
Fewer types:
Values are at the center of your computations. Only a handful of predefined types of values exist:
3 # int
"Candy" # text
Green # symbol (uppercase)
(Foo, Bar) # list
[Name: "Candy"] # struct
{ it -> add it 2 } # function
Not having a Hash/Dict type is very oldschool lisp-y.
- nerdponx 3y agoIf structs are just tables by another name, this sounds a lot like Lua to me. Not that there's anything wrong with Candy here, but I don't know that it's much of a departure from what we already have.
- rowanG077 3y agoI assume a struct is a Hash/Dict type. Since you have no type checking all fields can be considered dynamic.
- JonasWanke 3y agoExactly, structs are also used as maps/dictionaries, and the current implementation of them in our VM is as hash maps. (We have optimizations planned for this.) You'd create a struct with tags (symbols) as keys to create a typical struct/class, and can use arbitrary keys if you want to use it as a more general map: # A struct with two tags as keys mapping to functions httpServerStruct = [GetNextRequest: { … }, Close: { … }] # A map with text keys capitalCitiesMap = ["Germany": "Berlin", "France": "Paris"]
- kazinator 3y agoEven ancient Lisp was not without hash/dict processing. It was disguised in the interning of symbols, and symbol property lists.