Skip to content
This repository was archived by the owner on Jun 17, 2022. It is now read-only.

only store tail needed in containersΒ #125

@aep

Description

@aep

this sort of works in the call assign branch

new[map::key = char, +1000] m = map::make();
m.insert("hello", "world");

but its awkward, because its semantically char + tail.
it'll never work if we move to utf8

new[map::key = String, +1000] m = map::make();

will only store the String ref structure, not the actual content.

new[map::key = StringBuffer, +1000] m = map::make();

stores the entire stringbuffers tail, even if its half empty.

one solution to this is to enable dynamic tail sizes by using alloca instead of var decls for new calls,
something like

new str = string::from_cstr("foo");

could then do an strlen() to determine the tail needed is 3 bytes and alloca just that.

but i really hate it, because dynamically allocating stack has some real ugly security implications.
i can already see people copying unchecked strings from http connections and blowing up their stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions