C⏚ v2.0.0Updated 2026-05-12·Language

Bundles

A bundle is a stateless entity that holds types, constants, and pure helper functions. Bundles let tasks and networks share definitions without coupling their behaviour.

package com.neosyn.sha256;
 
bundle SHACommon {
  typedef u6 addr_t;
  u9 HASH_SIZE = 256;
 
  u32 Ch(u32 x, u32 y, u32 z) {
    return (x & y) ^ (~x & z);
  }
 
  u32 Maj(u32 x, u32 y, u32 z) {
    return (x & y) ^ (x & z) ^ (y & z);
  }
}

A bundle has no ports, no state variables, and no setup or loop. Every function it declares is implicitly const - the keyword is optional.

Referencing a bundle

There are three ways to use a bundle's members from another entity. Pick the shortest one that doesn't cause name conflicts.

Import everything, refer by short name:

import com.neosyn.sha256.SHACommon.*;
// addr_t, HASH_SIZE, Ch(), Maj() are now in scope

Import the bundle, refer by qualified name:

import com.neosyn.sha256.SHACommon;
// SHACommon.addr_t, SHACommon.Ch(), …

Refer by fully qualified name, no import:

com.neosyn.sha256.SHACommon.addr_t

Wildcard imports are convenient but can cause collisions when two bundles export the same name. Qualified imports avoid that.

What goes in a bundle

KindAllowedNotes
typedefYesShared type aliases
ConstantYesCompile-time values
FunctionYesImplicitly const
State variableNoBundles are stateless
PortNoBundles have no interface
setup / loopNoBundles have no behaviour

If a bundle needs state or behaviour, it should be a task instead.


Next: Tasks, Networks.