Hacker News new | ask | show | jobs
by mikewarot 917 days ago
It has to be able to link to and/or predictably generate machine code, for all the bootstrapping sections.

Ideally, it has to support a return stack, and a data stack.

I've seen ROM code that couldn't assume a return stack... not fun.

It would be really, REALLY nice if it could manage reference counted, counted, automatically allocated, strings, so that you could just use them without needing to allocate/free them, etc... just return a string like you return an integer.

2 comments

What about a built in string table sort of feature? Each string is recorded once in a central string table, and gets turned into a unique id. To get it back to string repr, just look it up.

Though that might count as too complex of a runtime for "low level", the idea is sometimes used in compilers to speed up and ergonomize basically everything that might deal with strings, which compilers do a lot.

Oh yes, automatic stack is a good one!

How do you think automatically managed strings might work, so that there is as little hidden code and costs as possible, but still decently ergonomic for your taste?

Would you consider automatic strings good enough if restricted to (a) statically known length, (b) statically known buffer size, or is it only worth it when they can be fully dynamic?

There is a nice implementation buried deep inside the Free Pascal run time libraries. There has to be some way to allocate memory at runtime for them to work properly.