Git Product home page Git Product logo

kocircuit's Introduction

Build Status

Ko

Experimental

The Ko language, library & tools are in active development, so do expect things to change.

Introduction

Ko is a concurrent, immutable, functional language.

Ko is both generic (function arguments and return values do not declare types) and type-safe (a new static-type inference algorithm ensures deep static type safety everywhere).

Ko is built on top of the Go runtime, in order to benefit from Go's rich ecosystem of integrations with industrial technologies.

Existing Go libraries and clients can be "exposed" in Ko with little relative effort. Protocol definitions, like Protocol Buffers or OpenAPI, can also be exposed in Ko using simple code-generation.

Getting started

To install the Ko interpreter, run:

go get -u github.com/kocircuit/kocircuit/lang/ko

Learning Ko

Perhaps the best way to learn the language is by reading sequentially through our step-by-step lessons.

Design, specifications and theory

An initial formal specification of the language (its underlying computational model, its syntax and its type system) can be found in the evolving Ko Handbook.

Why use Ko?

There are four main aspects of Ko which make it an interesting proposal:

  • Language. Ko is generic and at the same time entirely type-safe. Genericity means that functions do not have to declare argument and return value types, which makes them highly reusable. At the same time, when entire Ko programs are compiled against external protocols, services or types, they are fully-verified for type compliance.

  • Types. Ko uses a type-system which is the common denominator of industry protocol standards, like Protocol Buffers, Thrift, OpenAPI, and so on. These type systems are captured by structures, sequences (repeated types), primitive types, optional types and map types. This type system is already familiar to most programmers.

  • Architecture. The forthcoming Ko compiler compiles Ko programs to a high-level intermediate representation (IR) which can be used to code-generate an actual implementation in any language (e.g. Go, Java, C++, etc.) with relatively little effort. The IR produced by the Ko compiler is a collection of functions in SSA form, with deep type annotations everywhere.

  • Integrations. The Ko interpreter, being built on top of Go, can gain access to any technology available in Go by binding dynamically to it with little effort. This includes libraries and clients written in Go, as well as standards like Protocol Buffers and OpenAPI which have bindings for Go. The forthcoming Ko compiler, being a code-generating technology, can benefit from integrations with any target language, as described in the architecture bullet (above).

kocircuit's People

Contributors

ewoutp avatar mewmew avatar petar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kocircuit's Issues

handbook/language: clarify "generic macros"

I understand a "macro" to mean some code that is translated by the compiler into some other code in the source language. The macros described here seem more like built-in functions/varieties than macros to me. It might be nice to clarify how these constructs act as macros instead of special built-in operators or generic functions.

How to build the Handbook

When I run:

ko play github.com/kocircuit/kocircuit/handbook/Root

I get some kind of code on stdout, but no files are generated, and that code is not HTML.
How do I make sense of it, or how else would I generate the handbook?

proposal: Limit the use of dot imports in the Ko compiler

Hi,

To trouble shoot #5 (comment) I started at kocircuit/lang/go/sys/compile.go:31 trying to figure out where the code went wrong.

However, the use of dot imports made it much more difficult to follow where functions and types were declared. For instance CompileRepo is used in sys but defined in compile, and since compile is imported with dot imports, the qualified identifier did not include the package name. This also made it more difficult to find the functions and interfaces defined in syntax.

I therefore propose to stop using dot imports in the implementation of the Ko compiler, to facilitate readability of the code. This is especially important to help outsiders (such as myself) getting familiar and up to speed with the code.

All in all, I must say I find Ko to be very interested, and I will keep a close eye going forward.

With kindness,
Robin

Add required arguments

E.g. arguments that are followed by "!" in the declaration must be passed.
E.g, if F is declared as:

F(a, b!, c!) { ... }

Then the invocation F(b: 1, c: "abc") is correct. Whereas F(b: 1) is not correct, as "c" is required and not passed.

clarify the use of `ko play`

I followed the starting instructions, but "ko play" doesn't seem to want to play with me.

% ko play github.com/kocircuit/kocircuit/codelab/HelloWorld
(/home/rog/src/go/src/kocircuit/kocircuit/lang/go/sys/compile.go:31) (ko/R0) compiled functions=0 steps=0 steps-per-function=0.00
cannot find main circuit github.com/kocircuit/kocircuit/codelab/HelloWorld

It is not clear what the correct argument to "ko play" should be. The go play help doesn't document its positional arguments.

make Go struct tags follow conventions

In this document, we see that the ko struct tags define the Ko field name with a name=x tag directive. For example:

type GoMaxInt64 struct {   // gate argument structure
    X int64 `ko:"name=x"`   // The Ko field name is specified in a tag.
    Y int64 `ko:"name=y"`   // There are no restrictions on field types.
}

Since almost every single other serialization package encodes the name without an explicit name= prefix, and this is likely to be the most frequent tag attribute, then why not go with the usual Go convention?

type GoMaxInt64 struct {   // gate argument structure
    X int64 `ko:"x"`   // The Ko field name is specified in a tag.
    Y int64 `ko:"y"`   // There are no restrictions on field types.
}

Add MAINTAINERS.md

Topics that should be covered:

  • How to build
  • How to test
  • How to version & release

support go modules

It would be nice to support go modules by adding a go.mod file.

Using:

go mod init
go mod tidy

produces a compiling (but not necessarily working) module.

handbook/language: define "monadic sequence"

In the macro docs, it says:

Equal determines if its argument values are equal. It expects a monadic sequence argument.

but the docs don't seem to clarify exactly what a monadic sequence argument means. Is it a single-element sequence? A sequence of basic types? A sequence of one argument varieties?

Underscore arguments

Arguments whose name begins with underscore are waited on, but not passed to the called function.

Multiple repo roots

Support multiple colon-separated repo roots in KOPATH, searched in the order given.
This generalizes the notion of having a separate KOROOT and KOPATH variables.

Add `ko test`

Add support for unit tests (similar to go)

  • Only include *_test.ko files during testing
  • Add ko test <pkg> command
  • Add Assert like function(s)

handbook/language: clarify unification behavior on incompatible operands

I've probably missed something, but the unification rules seem incomplete.
Are there any unifications rules between different integer sizes, for example?

Perhaps something like this might suffice (assuming that's what you had in mind):

When two basic types p and q are being unified, U(p, q), the unification fails unless p and q are of the same basic type.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.