Skip to content

Updates to Dove

Latest
Compare
Choose a tag to compare
@huaqiwen huaqiwen released this 28 Jun 06:14
· 18 commits to master since this release
d41eae1

The Dove-lang v0.1.2

We've made many changes to Dove since v0.1.0, especially to the data structures.

New Features

  • #24 Support implicit returns for blocks:
fun explicit_return(a) {
  return a
}
print explicit_return(2)

fun implicit_return(a) {
  a
}
print implicit_return(3)

Output:

// explicit_return(2)
2
// implicit_return(3)
3
  • #31 Ability to import other .dove files.
  • #35 Support non-instance attributes, now you can call built-in methods on any Dove data types, example:
    (for a full list of supported builtin methods, please visit the Dove docs.)
let dict = {1: "one", 2: "two", 3:"three"}
for key in dict.keys() {
    print key
}

Output:

// Order is arbitrary.
"two"
"one"
"three"
  • #42 Support single-line lambda expression body.
// Single-line lambda expression body
let doubler = lambda a -> a * 2
print doubler(3)

// Multi-line lambda expression body
let tripler = lambda a -> {
  let res = 0
  for i in 0..3 {
    res += a
  }
  res
}
print tripler(4)

Output:

// Doubler
6
// Tripler
12

Bug Fixes

  • #34 Import cycles may cause infinite loop.