Warning This project is in its 'move fast and break things' stage, everything is EXPERIMENTAL.
A reimagination of Go, using unmodified official toolchain (currently go1.21
).
- Be FFI friendly: unless it's a kernel, all useful programs work with FFI heavily.
- Work natively
- Adapt to the running enviornment rather than insisting an opinionated way.
- Provide platform native APIs: managing platform SDKs really sucks, do no more!
- Expand* adoption of Go to...
- Web/Nodejs applications.
- Cross-platform GUI with native experience (native GUI widgets).
- Low-level system programming (think
crun
,systemd
), EFI applications. - Kernel and Firmware.
*There are already impressive achievements made in these areas using official std.
- Change the way the Go team works or make them change their decisions.
-
std
: A custom Go standard library and runtime. -
pcz
: A tool to build applications using custom std.pcz build
works likego build
(invokinggo tool compile/asm/link/pack
) but with different options.pcz dev
provides easy development enironment setup.
-
h2y
: A library to flatten AST.- generate API specifications from C/Objective-C header files and WebIDL files (using
llvm
andwebidl2.js
).
- generate API specifications from C/Objective-C header files and WebIDL files (using
-
ffigen
: A library to create go packages from specifications generated byh2y
.
NOTE We will open source
h2y
andffigen
after all platform sdks are added and the project itself gained enough popularity.
-
Install
go1.21
toolchain to your working machine- If you don't have any go toolchain installed, please refer to the official Go installation doc for guidance.
- Otherwise, you can download and install it by running
go install golang.org/dl/go1.21.2@latest
and"$(go env GOPATH)/bin/go1.21.2" install
, then it's available as"$(go env GOPATH)/bin/go1.21.2"
.
-
Install
pcz
from source code like most cli tools written in Go. (After running the command below, you may find thepcz
at"$(go env GOPATH)/bin/pcz"
)
go install github.com/primecitizens/pcz
Here are some examples for your reference.
In General:
- Use
github.com/primecitizens/pcz/std
as your stdlib, and make sure your application doesn't use packages from the official std.- Some of the packages may work, but due to the lacking of GC, there can be memory leaks in you application.
- Run
pcz
withgo1.21
toolchain, no other version of go toolchain is supported for now.- You can ensure this by setting the environment variable
GOROOT
to the path to the toolchain home (ifpcz
wasn't built with localgo1.21
toolchain).
- You can ensure this by setting the environment variable
- Import the runtime package explicitly (
import _ github.com/primecitizens/pcz/std/runtime
) in your application (usually inside themain
package).- This is because
pcz build
doesn't implicitly include a runtime for you.
- This is because
NOTE The std module is meant to be compatible with the go toolchain by using
pcz
(not thego
command).
-
append
-
make
-
slice
-
map
-
chan
-
-
new
-
go
-
defer
- inlined
defer
-
runtime.deferproc(deferFn)
- inlined
-
panic
- stacktrace
-
recover
-
map
- access (
val, ok := m[key]
) - assign (
m[key] = val
) - delete (
delete(m, key)
)
- access (
-
chan
- send (
chan <- x
) - receive (
x, ok := <- chan
) -
close
- send (
-
select
- block (
select {}
) - blocking (without default branch)
- non-blocking (with default branch)
- block (
- type switch (
switch x.(type)
) - type assertions (
y, ok := x.(T)
) -
clear
-
min
,max
(compiler intrinsic)
NOTE When using
make
andnew
, memory will be allocated using the default allocator of the current goroutine, which can be obtained by callingthread.G().G().DefaultAlloc()
.Currently our major focus is on providing support for platfrom natvie apis, thus most Go language features except those doesn't require runtime support are missing, this is mainly because most runtime features require allocation and scheduling, thus depends on platform apis we are working on (see ROADMAP.md for more details).
Read CONTRIBUTING.md for general guidelines.
Some elementary tasks:
- documentation
- estimate the minimum brain power need to understand the design.
- find
TODO
s in the source code and implement.- start from
ffi/js
can be a good choice.
- start from
- create meaningful examples.
Some intermediate tasks:
- parallel package build.
- port libraries from the official std with careful redesign.
- reimplement protocols with the new
encoding/binary
- minimum allocation.
- reimplement protocols with the new
- implement
math/matrix
package
Some hard tasks:
- (UI) design and implement a constraint-layout resolver.
- for web apps, it will replace the CSS box model (as we are going avoid using html attributes as much as possible (e.g.
id
,name
)). - for native platforms, it will be used to layout native widgets.
- for web apps, it will replace the CSS box model (as we are going avoid using html attributes as much as possible (e.g.
- (sched) design a framework for writing scheduler
- (gc) design a framework for writing garbage collectors based on the write barrier generated by Go toolchain.
This project won't be possible without the excellent work done by the Go team, if it was not the Go programming language, we could never find love in programming, let alone this project.
We would also like to thank everyone adopting Go to make programming in general more accessible to laypeople/peasants like us, your splendid resources really helped us to improve our understandings and skills.
WebIDL files copied from the Chromium project are licensed under its BSD 3-Clause License (LICENSE.chromium).
Code written by Prime Citizens is licensed under the Apache-2.0 License:
Copyright 2023 The Prime Citizens
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.