Skip to content

Name mangling specification

  • Mangling is always applied.
  • Type parameters are included in the mangled signature.
  • The prefix is pn::.
pn::<module_path>::<item_name>$<kind>(<param_types>,<return_type>)
  • Function: pn::net.http::connect$function(i64,str,Result[str])
  • Method: pn::net.http::Client::connect$method(self,Url,Result[str])
  • Generic: pn::collections::Map::insert$method(self,K,V,Option[V])
  • src/net/http.bd -> net.http
  • src/net/http/client.bd -> net.http.client
  • i64, f64, bool, str, ptr, unit are literal tokens.
  • Generic params use their identifier (K, V, T).
  • Composite types:
    • Option[T] -> Option[T]
    • Result[T,E] -> Result[T,E]
    • Array[T] -> Array[T]
  • Always-on mangling avoids symbol collisions across modules.
  • Type parameters in signature allow monomorphized symbols to coexist.
  • pn:: prefix ensures a unique namespace for linking.