Marko Tasic Profile picture
Feb 4 5 tweets 2 min read
In #colony #colang, bytes type is really not required as primitive type. str type should exist since it is unicode and mostly used by developers. However, bytes can be represented as Array<u8>.
Since #colony #colang is GC'ed using Reference Counting, refcount, or RC, we can introduce special kind of references called "immortal references" and an example is `bytes: type = Array<u8>`. This should be implementation detail and not exposed to developers.
Immortal objects are GC'ed. So, incref or decref is almost fast as NOP. It will need to check flag on object and determine if object is immortal. Immortal means it stays forever alive while programming is being executed.
Immortal objects without RC field are primitive types such as bool, ints, floats, and short-sized strings (less than 120bits).
All builtin types objects should be immortal. Ref counting them makes no sense. Imagine constantly recreating `bytes: type = Array<u8>` every time we encode str to bytes.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Marko Tasic

Marko Tasic Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @mtasic85

Feb 4
In C implementation of #colony #colang, every object has two fields, 64bit kind and 64bit value. Which means that we spend 2 64bit registers just present single value in case of primitive values such as bool, u8, u32, u64, i64, f64.
In case of GC'ed objects such as generic, array, dict, struct, union, and so on, we need indirection because these "structures" simply require more space. But in case of everything above, I think we can do better.
Perhaps, for abstract types we can move RC in "type" field, and limit mac RC count to 2 **56 which is quite large number, and currently good enough for our GC needs.
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(