mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-10 07:08:02 +00:00
Add a RocRefcounted trait in roc_std
This is required to properly handle refcounting of RocList. Without it, we can't tell if we need to get the length from the heap. That said, it isn't a pretty solution. I think dealing with generating bespoke type in glue would feel nicer than this but be much more work. It also would deal with the issue of implementations in the bitcode not matching external libraries. That said, it would require exposing way more symbols from roc for each monomophorphized list variant.
This commit is contained in:
parent
3c842196fa
commit
93fab26c01
9 changed files with 237 additions and 310 deletions
|
@ -9,8 +9,6 @@ import "../../roc_std/Cargo.toml" as rocStdCargoToml : Str
|
|||
import "../../roc_std/src/lib.rs" as rocStdLib : Str
|
||||
import "../../roc_std/src/roc_box.rs" as rocStdBox : Str
|
||||
import "../../roc_std/src/roc_list.rs" as rocStdList : Str
|
||||
import "../../roc_std/src/roc_dict.rs" as rocStdDict : Str
|
||||
import "../../roc_std/src/roc_set.rs" as rocStdSet : Str
|
||||
import "../../roc_std/src/roc_str.rs" as rocStdStr : Str
|
||||
import "../../roc_std/src/storage.rs" as rocStdStorage : Str
|
||||
|
||||
|
@ -45,8 +43,6 @@ staticFiles = [
|
|||
{ name: "roc_std/src/lib.rs", content: rocStdLib },
|
||||
{ name: "roc_std/src/roc_box.rs", content: rocStdBox },
|
||||
{ name: "roc_std/src/roc_list.rs", content: rocStdList },
|
||||
{ name: "roc_std/src/roc_dict.rs", content: rocStdDict },
|
||||
{ name: "roc_std/src/roc_set.rs", content: rocStdSet },
|
||||
{ name: "roc_std/src/roc_str.rs", content: rocStdStr },
|
||||
{ name: "roc_std/src/storage.rs", content: rocStdStorage },
|
||||
]
|
||||
|
@ -2006,16 +2002,16 @@ typeName = \types, id ->
|
|||
Num F32 -> "f32"
|
||||
Num F64 -> "f64"
|
||||
Num Dec -> "roc_std:RocDec"
|
||||
RocDict key value ->
|
||||
keyName = typeName types key
|
||||
valueName = typeName types value
|
||||
RocDict _key _value ->
|
||||
# keyName = typeName types key
|
||||
# valueName = typeName types value
|
||||
# "roc_std::RocDict<$(keyName), $(valueName)>"
|
||||
crash "RocDict is not yet supported in rust"
|
||||
|
||||
"roc_std::RocDict<$(keyName), $(valueName)>"
|
||||
|
||||
RocSet elem ->
|
||||
elemName = typeName types elem
|
||||
|
||||
"roc_std::RocSet<$(elemName)>"
|
||||
RocSet _elem ->
|
||||
# elemName = typeName types elem
|
||||
# "roc_std::RocSet<$(elemName)>"
|
||||
crash "RocSet is not yet supported in rust"
|
||||
|
||||
RocList elem ->
|
||||
elemName = typeName types elem
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue