Skip to content

Releases: wkgcass/Latte-lang

Latte-lang 0.0.10 ALPHA

11 Mar 15:43
Compare
Choose a tag to compare
Pre-release

gradle:

compile group:'org.latte-lang', name:'latte-build', version:'0.0.10-ALPHA'

maven:

<dependency>
  <groupId>org.latte-lang</groupId>
  <artifactId>latte-build</artifactId>
  <version>0.0.10-ALPHA</version>
</dependency>

New feature

Generic is now supported!! This is really a great work~

Now, you can attach generics on classes, interfaces and objects.

e.g.

class MyContainer<:T:>
    var t : T
    def get : T = t
    def set(t : T):Unit { this.t = t }

Fix

Issue #3 is fixed. The latte-gradle-plugin now works well with gradle 4.

Latte-lang 0.0.9.1 ALPHA

01 Nov 15:52
Compare
Choose a tag to compare
Pre-release

gradle:

compile group:'org.latte-lang', name:'latte-build', version:'0.0.9.1-ALPHA'

maven:

<dependency>
  <groupId>org.latte-lang</groupId>
  <artifactId>latte-build</artifactId>
  <version>0.0.9.1-ALPHA</version>
</dependency>

Modify

  1. remove new thread in scriptEngine.
  2. write asm to generate byte code instead of compile from a string when casting lambda object.

Latte-lang 0.0.9 ALPHA

24 Oct 13:38
Compare
Choose a tag to compare
Pre-release

gradle:

compile group:'org.latte-lang', name:'latte-build', version:'0.0.9-ALPHA'

maven:

<dependency>
  <groupId>org.latte-lang</groupId>
  <artifactId>latte-build</artifactId>
  <version>0.0.9-ALPHA</version>
</dependency>

Optimize

Now, inner methods and lambdas only capture necessary local variables, which is very good for performance.

Features

  1. UTF8 for names. Now you can use UTF8 chars to define variables, declare types etc.
  2. Haskell style indentation. Now, the indentations are not limited to 4, write what ever spaces you want. The rule is simple: more indentation means start a new layer, fewer indentation means fall back to some layer.
  3. packages now can be split with dot, just like Java. e.g. java.lang.Object and java::lang::Object are the same thing.

Fix

  1. Now Latte works fine if you load the Latte jars dynamically using URLClassLoader.

Latte-lang 0.0.8 ALPHA

23 Sep 21:05
Compare
Choose a tag to compare
Pre-release

gradle:

compile group:'org.latte-lang', name:'latte-build', version:'0.0.8-ALPHA'

maven:

<dependency>
  <groupId>org.latte-lang</groupId>
  <artifactId>latte-build</artifactId>
  <version>0.0.8-ALPHA</version>
</dependency>

New

  1. java 9 support, now you can write and compile latte code using java 9.
  2. jsr223 support
    ScriptEngine engine = new ScriptEngineManager().getEngineByName("Latte-lang");
    Object res = engine.eval("a = 1");
    engine.get("a");
  3. REPL now supports -e argument to evaluate the input expression and print the result
    latte -e 'a = 1; b = 2; a + b'
    

Change

  1. RichString adds a method get(int), so, now you can write "some-str"[3] to get char e
  2. data class now implements Cloneable and Serializable interfaces

Latte-lang 0.0.7 ALPHA

17 Mar 13:34
Compare
Choose a tag to compare
Pre-release

Switch to Gradle

gradle:

compile group:'org.latte-lang', name:'latte-build', version:'0.0.7-ALPHA'

maven:

<dependency>
  <groupId>org.latte-lang</groupId>
  <artifactId>latte-build</artifactId>
  <version>0.0.7-ALPHA</version>
</dependency>

New

  1. change jdk version from 1.8 to 1.6, so Android is supportted
  2. use gradle instead of maven, to make it easy to build with Android projects
  3. support annotations:
annotation AnnoName
    a:int = 1

Change

  1. remove =:= and !:=
  2. == and != now bond to eq(o) and ne(o). The object can implicitly cast to RichObject, which proxies the eq to equals, ne to ! equals

Latte-lang 0.0.6 ALPHA

05 Feb 22:45
Compare
Choose a tag to compare
Pre-release

New features: Implicit Cast and Destructing and Pattern-Matching
Some refactor

<dependency>
  <groupId>org.latte-lang</groupId>
  <artifactId>latte-build</artifactId>
  <version>0.0.6-ALPHA</version>
</dependency>

Features

Implicit Cast

implicit object X
    implicit def cast(i:Integer):RichInt = RichInt(i)

class RichInt(i:Integer)
    def add(i:Integer) = this.i + i

import implicit X
val res = RichInt(1) + 1 // res is 2

Destructing

data class Bean(a,b)

bean = Bean(1,2)
val (x,y) = bean

// or
// val (x,y) <- bean
// or
// Bean(x,y) <- bean

Pattern Matching

obj match
    case Bean(a,b) -> ... // destruct
    case 1 -> ... // match by value
    case _:X -> ... // match by type
    case _ -> .... // default

check document for more info.

Refactor

  1. regex literal is removed, use 'regex'.r instead
  2. one line comment starts with // now (used to be ;)
  3. empty map literal is {}, but non-empty map should be [... : ...]
  4. any {...} with content inside represents layer control symbol
  5. |- and -| are removed
  6. define and undef are removed
  7. .. and .: are removed, use 1 to 10 / 1 until 10 instead

Latte-lang 0.0.5 ALPHA

12 Jan 13:55
Compare
Choose a tag to compare
Pre-release

New features and fixed some bugs

<dependency>
  <groupId>org.latte-lang</groupId>
  <artifactId>latte-build</artifactId>
  <version>0.0.5-ALPHA</version>
</dependency>

Features

1. support recursive lambda

x = i -> if i < 0 { 0 } else { x(i-1) }

2. def modifier

def method
def method()
def method():Unit
def method=1
def method()=1
def method():int=1

3. object class

object TypeName
    ...

It's a singleton object

4. invoke with name enhanced

e.g.

file = open('...', mode='r')

5. cast a map to an object

6. lambda object itself is a parameter

use $ to access the object

lt> x = ()->$
  |
x : Evaluate$Latte$Lambda$0 = Evaluate$Latte$Lambda$0@3e9b1010

lt> x()
  |
res0 : Evaluate$Latte$Lambda$0 = Evaluate$Latte$Lambda$0@3e9b1010

7. await (EXPERIMENTAL FEATURE, WILL CHANGE LATER)

block the current thread until the method finishes

Changing

  1. repl support jline, but jline jar is not included, add it to classpath if needed
  2. launch script upgrade
  3. use Unit, it's now an object class. void and undefined no longer exist (method with Unit return type will be compiled into void)
  4. change pkg to internal
  5. return value on void method can pass compile
  6. detailed error report when getting/putting fields or invoking methods

Library

  1. a new test library for async test

Latte-lang 0.0.4 ALPHA

15 Oct 12:58
Compare
Choose a tag to compare
Pre-release

It's a wonderful release.
I've been using Latte to write the front-end of server-side web code, such as the controller layer and calling services. And there're no bugs occurred!
However the features are not completed, so it's still an ALPHA version.

Download and run mvn clean package, then enjoy!

or use as a library:

<dependency>
  <groupId>org.latte-lang</groupId>
  <artifactId>latte-build</artifactId>
  <version>0.0.4-ALPHA</version>
</dependency>

Note that all features might be changed in later ALPHA versions.

RELEASE NOTE

reversed method invocation

class X
    reverse_subtract(o)=...

x = X
1 - x    ; same as calling x.reverse_subtract(1)

calling functional object

Full support for calling functional object

implicit param lambda

list.stream.filter
    it > 2

generator specifying upgrade

scanner support both brace and indent AND scanner layer control symbol

;; :scanner-brace
list.stream.filter{ it > 2 }.forEach{ println(it) }
;; :scanner-indent
list.stream.filter|- it > 2 -|.forEach|- println(it) -|

string template

main(args : []String)
    println("arg 0 is ${args[0]}")

js ||

a = a || 1

inner method can modify the captured variables

outer()
    var x = 1
    inner()
        x += 3
    inner()
    return x

res = outer()  ; res is 4

function is directly invoked

fun Add(a, b)
    return a + b

Add(1, 3)   ; result is 4

implicit return

if a method requires a return value, then if the last statement is an expression, it will be returned.

Latte-lang 0.0.3 ALPHA

06 Aug 19:45
Compare
Choose a tag to compare
Pre-release

Maven Support

compiler and libraries

<dependency>
    <groupId>org.latte-lang</groupId>
    <artifactId>latte-build</artifactId>
    <version>0.0.3-ALPHA</version>
</dependency>

maven plugin

<plugin>
    <groupId>org.latte-lang</groupId>
    <artifactId>latte-maven-plugin</artifactId>
    <version>0.0.3-ALPHA</version>
    <executions>
        <execution>
            <id>compile</id>
            <phase>compile</phase>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
        <execution>
            <id>test-compile</id>
            <phase>test-compile</phase>
            <goals>
                <goal>test-compile</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Regular Expression

pattern = //\d+//

The regular expression is a java.util.regex.Pattern object.

Dynamic Method Invocation

define a method and invoke any method on the type/object.

static
    call($this:Object, methodName:String, primitives:[]bool, arguments:[]Object)
        ...
  • $this - the object to invoke from. or null if invoke static
  • methodName - the method's name
  • primitives - whether each argument is primitive
  • arguments - the arguments

Calling Functional Object

func = (a, b)->a + b
res = func()

call a functional object just like calling a method.

Latte-lang 0.0.2 ALPHA

24 Jun 05:17
Compare
Choose a tag to compare
Pre-release

Note that it's still an ALPHA version.
Fixed bugs and corner cases.

New features

Function type definition

fun FunctionName [ ( params [: Type] ) ] [:FunctionalInterface | FunctionalAbstractClass]
    ...
    return something

e.g.

fun IndexRouter(routingContext)
    routingContext.response.end("Hello")

router.route("/").handler(IndexRouter)

a class would be defined and the only abstract method would be overridden and filled with the code body.

Construct with type name

sb = StringBuilder

invokes the constructor with zero parameters.