Releases: wkgcass/Latte-lang
Latte-lang 0.0.10 ALPHA
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
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
- remove new thread in scriptEngine.
- write asm to generate byte code instead of compile from a string when casting lambda object.
Latte-lang 0.0.9 ALPHA
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
- UTF8 for names. Now you can use UTF8 chars to define variables, declare types etc.
- 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.
- packages now can be split with
dot
, just like Java. e.g.java.lang.Object
andjava::lang::Object
are the same thing.
Fix
- Now Latte works fine if you load the Latte jars dynamically using URLClassLoader.
Latte-lang 0.0.8 ALPHA
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
- java 9 support, now you can write and compile latte code using java 9.
- jsr223 support
ScriptEngine engine = new ScriptEngineManager().getEngineByName("Latte-lang"); Object res = engine.eval("a = 1"); engine.get("a");
- REPL now supports
-e
argument to evaluate the input expression and print the resultlatte -e 'a = 1; b = 2; a + b'
Change
- RichString adds a method
get(int)
, so, now you can write"some-str"[3]
to get chare
- data class now implements Cloneable and Serializable interfaces
Latte-lang 0.0.7 ALPHA
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
- change jdk version from 1.8 to 1.6, so Android is supportted
- use gradle instead of maven, to make it easy to build with Android projects
- support annotations:
annotation AnnoName
a:int = 1
Change
- remove =:= and !:=
- == and != now bond to
eq(o)
andne(o)
. The object can implicitly cast to RichObject, which proxies the eq to equals, ne to ! equals
Latte-lang 0.0.6 ALPHA
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
- regex literal is removed, use
'regex'.r
instead - one line comment starts with
//
now (used to be;
) - empty map literal is {}, but non-empty map should be [... : ...]
- any {...} with content inside represents layer control symbol
- |- and -| are removed
- define and undef are removed
- .. and .: are removed, use 1 to 10 / 1 until 10 instead
Latte-lang 0.0.5 ALPHA
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
- repl support jline, but jline jar is not included, add it to classpath if needed
- launch script upgrade
- use Unit, it's now an object class. void and undefined no longer exist (method with Unit return type will be compiled into void)
- change
pkg
tointernal
- return value on void method can pass compile
- detailed error report when getting/putting fields or invoking methods
Library
- a new test library for async test
Latte-lang 0.0.4 ALPHA
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
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
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.