What is Wing and how does it work?
mainWing is a cloud-oriented programming language designed to treat the cloud as a single computer. Instead of managing individual machines, developers use high-level cloud primitives to build distributed systems.
When you compile Wing code, the compiler generates two main components:
- Infrastructure Artifacts: (e.g., Terraform files) that define the required cloud resources.
- Runtime Code: (e.g., JavaScript) that runs on cloud compute resources.
Key features include:
- Cloud Portability: High-level primitives can target different cloud providers (e.g., mapping a
cloud.Queueto Amazon SQS when targeting AWS). - Local Cloud Simulator: Allows for rapid iteration, end-to-end unit testing of architectures, and local debugging without deploying to a real cloud provider.
- Wing Console: A visual management console used to interact with the local cloud simulator, view logs, and inspect resources.
bring cloud;
let queue = new cloud.Queue(timeout: 2m);
let bucket = new cloud.Bucket();
let counter = new cloud.Counter(initial: 100);
queue.setConsumer(inflight (body: str) => {
let next = counter.inc();
let key = "myfile-{next}.txt";
bucket.put(key, body);
});