gracelang / minigrace

Self-hosting compiler for the Grace programming language
39 stars 22 forks source link

In the JS backend, defs return a value #149

Closed apblack closed 9 years ago

apblack commented 9 years ago

The following method works with the JS backend:

method productUsingFold(input:List<Number>) -> Number {
    // returns the product of the numbers in input.
    def listProduct = input.fold{a, b -> a*b}startingWith(1)
}

Evidently, the def returns a value. With the C backed, this method returns done.

The same seems to be true for var declarations.

apblack commented 9 years ago

This is fixed in ce3b44ed.