Giter Site home page Giter Site logo

colang-scala's People

Stargazers

 avatar  avatar

Forkers

merkispavel

colang-scala's Issues

Add more integer types

Right now the only supported integer type is int, which is a signed 32-bit integer. This length is often too small, and sometimes too large. To give user more control, the following signed integer types should be supported:

  • int8
  • int16
  • int32
  • int64
  • int - alias for int64

Type names are self-explanatory. int is changed to an alias for int64. This is debatable, but the main reasoning is that int overflows are far more common when coding in C++ than they should be. Making 64-bit integers the default should prevent such nasty bugs.

Support variable input at definition site

Make read a specifier that is allowed on local variables and has the following effect:

read int a, b

is equivalent to

int a, b
readl(a)
readl(b)

The overloaded function read will have to be renamed: readl is used above (from 'read late'), but other options are welcome as well.

Support variable and field type inference

Add a var keyword, that can appear instead of type in variable and field definitions. Variables defined as such will have their type inferred from the initializer type: var a = 5 is equivalent to int a = 5.

Variable definitions with var but without initializer should be considered invalid.

The syntax should allow defining variables of different types in a single statement like this:

var a = 3.14, b = true

This is equivalent to:

double a = 3.14
bool b = true

Implement errors

Add an error statement that unconditionally terminates the program (like exit(). It may also print an error message if used like error "Some message.".
Code flow analysis routines (e.g. unreachable code checker) must handle errors correctly.

Support generic types

Generic types are a must-have feature for designing a convenient standard library. All container types are generic by nature, even the most basic ones like constant-length array.

The semantics we'd like to have are close to C++'s templates, except only typename parameters are allowed. Compilation time calculations will be likely eventually supported in a different form.

The main problem in implementing generic types is designing a robust type-checking system that allows compiler to find invalid generic type instantiations and report them in a readable way. The proposed solution for this problem is a trait system, which will be described in a separate issue. The initial generic implementation should only allow operations supported by all types (construction and assignment). This should be enough to implement basic collections.

The proposed syntax is the same as in C++ and Java: angle brackets for type parameters (e.g. Vector<T>).

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.